mohitmishra786/low-level-dev-skills/compiler-frontend
Claude Code and agent skill by mohitmishra786/low-level-dev-skills
- community
Checking that the SKILL.md file is still in the repository.
Compiler frontend skill for lexing, parsing, and type checking. Use when building a lexer/parser, designing AST nodes, implementing symbol tables, type checking, error recovery, or emitting LLVM IR. Activates on queries about lexer, Pratt parser, recursive descent, AST, symbol table, Hindley-Milner, or llvm-sys.
Install
npx vskill@latest install mohitmishra786/low-level-dev-skills/compiler-frontendSKILL.md
Compiler Frontend
Purpose
Guide agents through building a compiler frontend: lexers (hand-written DFA vs flex), Pratt parsing for expressions, recursive-descent for statements, AST design, symbol tables with scoped hash maps, type checking basics, error recovery strategies, and LLVM IR generation via the C API or llvm-sys.
When to Use
- Implementing a new programming language or DSL
- Adding expression parsing to an interpreter or config language
- Designing AST node hierarchies in C or Rust
- Building scoped symbol tables for variables and functions
- Implementing basic type inference or checking
- Emitting LLVM IR from a typed AST
Workflow
1. Pipeline overview
2. Lexer — hand-written DFA
3. Pratt parser for expressions
Pratt handles operator precedence cleanly without massive grammar tables.
4. Recursive descent for statements
5. AST and symbol table
6. Type checker (basics)
Hindley-Milner (full inference): assign type variables, unify on constraints — use for ML-like languages.
7. Error recovery
| Strategy | When | |
|---|---|---|
| Panic mode | Skip tokens until synchronizing token (;, }) | |
| Synchronization sets | Define recovery tokens per nonterminal | |
| Error productions | Grammar rules for common mistakes | |
| Single-token insertion/deletion | IDE-friendly recovery |
8. LLVM IR generation
Rust: use inkwell or llvm-sys crates for safer bindings.
Common Problems
| Symptom | Cause | Fix | |
|---|---|---|---|
| Parser infinite loop | Missing advance on error | Audit all branches advance token | |
| Wrong operator precedence | Incorrect binding powers | Table-test expressions | |
| Duplicate symbol in scope | No shadowing check | Lookup parent only for read; define in current | |
| LLVM verify fails | Type mismatch in IR | Check signedness, pointer levels | |
| flex token clash | Overlapping patterns | Longest match; order rules | |
| Error cascade | No synchronization | Implement panic mode recovery |
Related Skills
skills/compiler-internals/llvm-passes— optimize generated IRskills/compiler-internals/jit-compilation— execute generated IRskills/compiler-internals/mlir— higher-level IR for DSLsskills/compilers/llvm— LLVM as a user (opt, llc)skills/low-level-programming/interpreters— bytecode VM alternativeskills/languages/carbon-lang— modern language frontend example
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/compiler-internals/compiler-frontend/SKILL.md
Popularity
- Repository stars
- 237
- Repository forks
- 28
- 7-day trend score
- 27
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mohitmishra786/low-level-dev-skills/compiler-frontend)