本文へ移動
cccskills
無料GitHub で公開

compiler-design-expert

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

インストール方法を見る

含まれるファイル(2)

  • SKILL.md2.8 KB
  • .gitkeep0 B

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

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

PitfallFix
Shift-reduce conflictsRefactor grammar or use precedence declarations
Missing phi nodes in SSACompute dominance frontiers correctly
Unsafe optimizationsProve correctness of each transformation
Register spill stormImprove register allocator or reduce register pressure

Related Skills

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

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Expert-level abstract algebra knowledge. Use when working with groups, rings, fields, modules, Galois theory, representation theory, or algebraic structures. Also use when the user mentions 'group', 'ring', 'field', 'homomorphism', 'isomorphism', 'normal subgroup', 'quotient group', 'Sylow theorem', 'Galois theory', 'polynomial ring', 'ideal', 'module', 'vector space', or 'representation theory'.

日本語の概要は準備中です。原文の説明を表示しています。

luokai0/ai-agent-skills-by-luo-kai122026年5月6日 更新

Expert-level acoustics knowledge. Use when working with sound waves, acoustic propagation, resonance, standing waves, Doppler effect, room acoustics, ultrasound, noise control, musical acoustics, or architectural acoustics. Also use when the user mentions 'sound wave', 'decibel', 'frequency', 'resonance', 'standing wave', 'Doppler effect', 'acoustic impedance', 'reverberation', 'ultrasound', 'noise control', 'harmonics', or 'sound intensity'.

日本語の概要は準備中です。原文の説明を表示しています。

luokai0/ai-agent-skills-by-luo-kai122026年5月6日 更新

Expert-level aerodynamics covering subsonic and supersonic flow, lift and drag, airfoil theory, boundary layers, compressible flow, and CFD methods.

日本語の概要は準備中です。原文の説明を表示しています。

luokai0/ai-agent-skills-by-luo-kai122026年5月6日 更新

Expert-level air quality engineering covering pollutant sources, atmospheric dispersion, air quality standards, emission controls, and air quality modeling.

日本語の概要は準備中です。原文の説明を表示しています。

luokai0/ai-agent-skills-by-luo-kai122026年5月6日 更新

Expert-level aircraft structures covering structural design philosophy, wing and fuselage analysis, fatigue and damage tolerance, composite structures, and certification.

日本語の概要は準備中です。原文の説明を表示しています。

luokai0/ai-agent-skills-by-luo-kai122026年5月6日 更新

Expert-level algorithms and complexity theory covering sorting, searching, graph algorithms, dynamic programming, greedy algorithms, NP-completeness, and algorithm design paradigms.

日本語の概要は準備中です。原文の説明を表示しています。

luokai0/ai-agent-skills-by-luo-kai122026年5月6日 更新

luokai0 のスキルをすべて見る

このスキルの問題を報告する