CDTk Documentation
Welcome to the CDTk v9.0 documentation. This wiki covers every aspect of the Compiler Description Toolkit — from grammar definition to native binary output.
New in v9.0
LESS CSS redesign, full .NET 10 support, improved QUILL ML pipeline with 128-dim feature vectors, and CRAB x86 PE EXE generation.Quick Navigation
Getting Started
Install CDTk and compile hello world in 5 minutes.
→Lexical Analysis
Tokenize source text with the declarative token DSL.
→Syntax Analysis
Rules, nonterminals, and parse-tree construction.
→Semantic Analysis
SemanticTable, ObjectRow, MorphismRow, CBOR.
→Code Generation
Override Render() to generate target-language syntax.
→Pattern Matching
Structural roles and translation patterns.
→Language Builder
End-to-end guide: build a complete language.
→Diagnostics
Error reporting, warnings, and compile-time messages.
→Examples
Real-world: C#↔Python, WASM, PE EXE, and more.
→Pipeline Overview
CDTk translates source code through a 6-step pipeline:
- Lexing — source text is tokenized using the grammar's token declarations.
- Parsing — tokens are assembled into a parse tree using rule definitions.
- Structural role assignment — tokens are tagged with semantic roles (e.g.,
IfKeyword). - Semantic table construction — the parse tree is mapped to a
SemanticTable. - Translation — morphisms map source semantics to target semantics.
- Code generation —
Grammar.Render(SemanticTable)emits target syntax.