Skip to content
Skillv1.0.0

compiler-design-expert

Expert-level compiler design covering lexical analysis, parsing, semantic analysis, intermediate representations, optimization passes, and code generation.

by luokai0(0) 0 installs
Free
Sign in to install

Free account. Installing gives you the manifest plus copy-paste snippets.

See reviews

About

Imported from luokai0/ai-agent-skills-by-luo-kai (ai-agent-skills/17-emerging-tech (by Luo Kai)/compiler-design-expert/SKILL.md). Install upstream with npx skills add luokai0/ai-agent-skills-by-luo-kai --skill compiler-design-expert. Copyright stays with the author.

Compiler Design Expert

Before Starting

  1. Which compilation phase?
  2. New language or existing compiler modification?
  3. Optimization or correctness focus?

Core Expertise Areas

Lexical Analysis

Tokens: atomic units — keywords, identifiers, literals, operators. Regular expressions: define token patterns. Finite automata: DFA and NFA implement lexers. Lexer generators: Lex, Flex, ANTLR — generate lexer from token rules.

Parsing

Context-free grammars: productions defining language syntax. Top-down: recursive descent, LL parsers — predictive, left-to-right. Bottom-up: LR parsers — shift-reduce, more powerful, handles more grammars. Parser generators: Yacc, Bison, ANTLR — generate parser from grammar. Parse tree vs AST: AST removes redundant nodes, better for analysis.

Semantic Analysis

Type checking: static vs dynamic typing, type inference. Symbol table: scope management, variable binding, type lookup. Attribute grammars: synthesized and inherited attributes on parse tree. Name resolution: binding identifiers to declarations.

Intermediate Representation

Three-address code: at most three operands per instruction. SSA form: single static assignment, each variable defined exactly once. LLVM IR: typed, SSA-based, platform-independent, widely used. Control flow graph: basic blocks connected by edges.

Optimization

Constant folding: evaluate constant expressions at compile time. Dead code elimination: remove unreachable or unused code. Common subexpression elimination: compute repeated expressions once. Loop optimizations: unrolling, invariant code motion, vectorization. Inlining: replace function call with function body.

Code Generation

Instruction selection: map IR to target instructions. Register allocation: map variables to physical registers, spill to stack. Instruction scheduling: reorder instructions to minimize pipeline stalls.

Best Practices

  • Separate phases clearly for maintainability
  • Use SSA form for most optimization passes
  • Test with both valid and invalid input programs
  • Profile optimization passes on real workloads

Common Pitfalls

Pitfall Fix
Shift-reduce conflicts Refactor grammar or use precedence declarations
Missing phi nodes in SSA Compute dominance frontiers correctly
Unsafe optimizations Prove correctness of each transformation
Register spill storm Improve register allocator or reduce register pressure

Related Skills

  • compiler-expert
  • algorithms-cs-expert
  • computer-architecture-expert

Use it

Copy one of these into your project. Installing also returns the manifest and these snippets.

yaml
targets:
  - https://api.opensmartroute.ai/api/v1/registry/luokai0-ai-agent-skills-by-luo-kai-compiler-design-expert/manifest   # or paste the manifest below

Manifest

An Open Capability Manifest: the router reads it to know what this does, what it costs and when to pick it.

luokai0-ai-agent-skills-by-luo-kai-compiler-design-expert.ocm.jsonjson
{
  "ocm": "1",
  "id": "luokai0-ai-agent-skills-by-luo-kai-compiler-design-expert",
  "kind": "skill",
  "name": "compiler-design-expert",
  "description": "Expert-level compiler design covering lexical analysis, parsing, semantic analysis, intermediate representations, optimization passes, and code generation.",
  "publisher": "luokai0",
  "version": "1.0.0",
  "capabilities": {
    "domains": [
      "coding"
    ],
    "tags": [
      "skill-md",
      "compilers",
      "parsing",
      "ast",
      "optimization",
      "code-generation",
      "llvm",
      "github"
    ],
    "languages": [
      "en"
    ]
  },
  "quality_prior": 0.6,
  "examples": [
    "Expert-level compiler design covering lexical analysis, parsing, semantic analysis, intermediate representations, optimization passes, and code generation."
  ],
  "primary": false,
  "metadata": {
    "source": {
      "provider": "github",
      "repository": "https://github.com/luokai0/ai-agent-skills-by-luo-kai",
      "path": "ai-agent-skills/17-emerging-tech (by Luo Kai)/compiler-design-expert/SKILL.md",
      "ref": "4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c",
      "url": "https://github.com/luokai0/ai-agent-skills-by-luo-kai/blob/4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c/ai-agent-skills/17-emerging-tech (by Luo Kai)/compiler-design-expert/SKILL.md",
      "key": "luokai0/ai-agent-skills-by-luo-kai/ai-agent-skills/17-emerging-tech (by Luo Kai)/compiler-design-expert/SKILL.md"
    }
  },
  "instructions": "# Compiler Design Expert\n\n## Before Starting\n1. Which compilation phase?\n2. New language or existing compiler modification?\n3. Optimization or correctness focus?\n\n## Core Expertise Areas\n\n### Lexical Analysis\nTokens: atomic units — keywords, identifiers, literals, operators.\nRegular expressions: define token patterns.\nFinite automata: DFA and NFA implement lexers.\nLexer generators: Lex, Flex, ANTLR — generate lexer from token rules.\n\n### Parsing\nContext-free grammars: productions defining language syntax.\nTop-down: recursive descent, LL parsers — predictive, left-to-right.\nBottom-up: LR parser",
  "cost": {
    "context_tokens": 634
  }
}

Fetch it by URL: GET /api/v1/registry/luokai0-ai-agent-skills-by-luo-kai-compiler-design-expert/manifest?version=1.0.0

Reviews

Star ratings from people who tried it. One review per account; edit yours any time.

No reviews yet. Install it, try it, and be the first to rate it.