Get up and running with Compiler Copilot in 5 minutes!
git clone <repository-url>
cd CompilerCopilotchmod +x setup.sh
./setup.shThis will:
- Create a Python virtual environment
- Install all dependencies
- Set up directory structure
- Create configuration template
cp config/env.example config/.envEdit config/.env and set at minimum:
# Required: Choose your debugger
DEBUGGER_PATH=/usr/bin/gdb
DEBUGGER_TYPE=gdb
# Required: Set compiler paths
CLANG_PATH=/usr/bin/clang
LLVM_PATH=/usr/lib/llvm-14
# Required: Choose LLM provider and add API key
LLM_PROVIDER=watsonx
LLM_API_KEY=your_api_key_here
LLM_MODEL=ibm/granite-13b-chat-v2source venv/bin/activate
./compiler-copilot.shOnce the shell starts, try these commands:
copilot> status
copilot> help
copilot> generate ir examples/sample_program.c --opt O2
copilot> debug examples/sample_program --debugger gdb
copilot> run
copilot> explain what LLVM IR is
# Compile with debug info
gcc -g myprogram.c -o myprogram
# Start Compiler Copilot
./compiler-copilot.sh
# In the shell:
copilot> debug myprogram
copilot> run
# (program crashes)
copilot> analyze the crash and tell me what happenedcopilot> generate ir mycode.c --opt O0
copilot> generate ir mycode.c --opt O2
copilot> explain the differences and which passes were appliedcopilot> generate test for: use-after-free in linked list
# AI generates a test case
# Copy the code to a file and compileInstall GDB:
# Ubuntu/Debian
sudo apt-get install gdb
# macOS
brew install gdb
# Fedora/RHEL
sudo dnf install gdbReinstall dependencies:
source venv/bin/activate
pip install -r requirements.txtCheck your API key in config/.env:
# Make sure it's set correctly
LLM_API_KEY=your_actual_api_keyMake it executable:
chmod +x compiler-copilot.sh
chmod +x setup.sh- Use Tab Completion: Press Tab to see available commands
- Natural Language: Just describe what you want to do
- Check History: Use Up/Down arrows to navigate command history
- Save Output: Important findings can be copied from the terminal
- Multiple Sessions: You can run multiple instances in different terminals
- Start with
helpcommand - Try the sample program
- Experiment with IR generation
- Ask questions in natural language
- Debug real programs
- Analyze optimization passes
- Generate test cases
- Compare different optimization levels
- Integrate with your workflow
- Create custom scripts
- Contribute new features
- Extend with new tools
- Read examples/workflow_examples.md for detailed workflows
- Check ARCHITECTURE.md to understand the internals
- See CONTRIBUTING.md to contribute
- In-shell help: Type
help - Documentation: Check README.md and other docs
- Issues: Open a GitHub issue
- Questions: Use GitHub Discussions
To verify everything is working:
# 1. Activate environment
source venv/bin/activate
# 2. Run the shell
./compiler-copilot.sh
# 3. In the shell, run:
copilot> status
# Should show your configuration
copilot> generate ir examples/sample_program.c
# Should generate IR code
copilot> explain what this tool does
# Should get an AI responseIf all three work, you're ready to go! 🎉
| Command | Description |
|---|---|
help |
Show all commands |
status |
Show current session status |
debug <program> |
Start debugging |
generate ir <file> |
Generate LLVM IR |
generate assembly <file> |
Generate assembly |
analyze crash <exe> |
Analyze crash |
explain <topic> |
Get explanation |
quit |
Exit the shell |
Happy debugging! 🐛🔍