Now at version 9.0 — .NET 10 ready

CDTk

Compiler Description Toolkit
Build, translate & analyze programming languages with a hacker-grade .NET toolkit

cdtk — bash — 80x24
$ dotnet add package CDTk
Determining projects to restore...
Added 'CDTk 9.0.0' to project.csproj
$ dotnet run --project mycompiler
✓ Compiled 1,024 tokens in 2ms
$
Core Capabilities

Everything You Need to Build a Compiler

CDTk provides a complete pipeline from grammar definition to binary output — all in pure .NET with zero runtime dependencies.

Declarative Grammars

Define lexers and parsers using a clean C# DSL. Tokens, rules, and structural roles are declared as static fields — no code-gen step needed.

LexerParserDSL
Multi-Language Translation

Translate source code between C#, Python, JavaScript, WASM, and LLVM IR using the semantic pipeline with round-trip fidelity.

C#PythonWASMLLVM
💡
Semantic Analysis

Rich semantic tables map objects, morphisms, and two-cell transformations. The CBOR-based binary format ensures efficient serialization.

CBORSemanticTable
🤖
QUILL ML Integration

QUILL adds machine-learning-powered token classification using ML.NET with a 128-feature vector extracted from the UAB pipeline.

ML.NETQUILL128-dim
💻
x86 Native Codegen

CRAB compiles to native x86 Windows PE executables via the integrated X86AsmParser, X86CodeGen, and PeWriter pipeline — zero LLVM needed.

x86PE/EXECRAB
📦
SDXF Bundle Format

Package input/output grammars and source files into a single binary SDXF bundle with tagged frames — perfect for toolchain distribution.

SDXFBinaryF#
Quick Start

Up and Running in Minutes

Install CDTk via NuGet and write your first grammar in under 5 minutes.

# Install via .NET CLI
$ dotnet add package CDTk
Restored packages in 320ms

# Build the solution
$ dotnet build CDTk.slnx
✓ Build succeeded.

# Run tests
$ dotnet run --project Testing/Testing.csproj
✓ All 8 phases passed
// MyLang.cs - Minimal grammar definition
using CDTk;

public class MyLang : Grammar {
  // Token declarations
  public static Token KW_IF = Kw("if");
  public static Token KW_RET = Kw("return");
  public static Token IDENT = Id();
  public static Token INT = Num();

  // Structural roles
  public static Map Structural = new() {
    { KW_IF, "IfKeyword" }
  };
}
// Compile source text in-memory
var result = Compiler.CompileText(
  input: new CSharpGrammar(),
  output: new PythonGrammar(),
  source: csSource
);

// Binary round-trip
byte[] bin = Compiler.CompileToBinary(csSource);
string back = Compiler.DecompileFromBinary(bin);

✓ 1024 tokens in 2ms
# 9-step translation chain stress test
$ dotnet run --project Testing

Phase 1: C# -> JS [PASS]
Phase 2: JS -> C# (rt) [PASS]
Phase 3: JS -> C# [PASS]
Phase 4: C# -> JS (rt) [PASS]
Phase 5: Py -> JS [PASS]
Phase 6: JS -> Py (rt) [PASS]
Phase 7: C# -> Py [PASS]
Phase 8: Py -> C# (rt) [PASS]

✓ All 8 phases passed
1
Install CDTk

Add the NuGet package or clone the repo. Targets .NET 10 (QUILL targets .NET 8).

2
Define a Grammar

Subclass Grammar, declare tokens as static fields, and assign structural roles via a Map.

3
Compile or Translate

Use Compiler.CompileText() to translate between grammars, or CompileToBinary() for native output.

4
Override Render()

Customize output by overriding Grammar.Render(SemanticTable) to generate target-language syntax.

5
Distribute as SDXF Bundle

Package grammars and source files into a self-contained SDXF binary bundle for easy toolchain sharing.

Pipeline

Inside the Translation Pipeline

  +-------------------------------------------------------------+
  |                  CDTk Translation Pipeline                   |
  +-------------------------------------------------------------+

  Source Text / Binary
        |
        v
  +-------------+    +--------------+    +------------------+
  |  Grammar A  |--->|  UAB Parser  |--->|  SemanticTable   |
  |  (tokens +  |    |  (F# core)   |    |  ObjectRow       |
  |   rules)    |    |  Step 1-3    |    |  MorphismRow     |
  +-------------+    +--------------+    |  TwoCellRow      |
                                         +--------+---------+
                                                  |
                                                  v
  +-------------+    +--------------+    +------------------+
  |  Grammar B  |<---|  Codegen     |<---|  Translator      |
  |  (target)   |    |  Render()    |    |  Step 4-6        |
  |             |    |  override    |    |  (morphism map)  |
  +-------------+    +--------------+    +------------------+
        |
        v
  Output Text / Binary  (PE EXE via CRAB, WASM via wasm-target)

  Optional paths:
  ---------------------------------------------------------------
  SDXF Bundle --> SdfxEncoder --> UAB SdfxDecode --> Grammar
  QUILL       --> ML.NET SDCA --> Token Class    --> Semantic
  CRAB        --> X86AsmParser -> X86CodeGen     --> PeWriter
      
By the Numbers

Built for Scale

🌐
0
Language Grammars
🔤
0
Max Grammar Tokens
🧪
0
Test Phases
🔁
0
Translation Steps
2ms
Avg Compile Time
🤖
0
QUILL Feature Dims
Language Support

Grammars for Every Target

C#
JavaScript
Python
WebAssembly
LLVM IR
x86 ASM
PE EXE
SDXF Binary
CBOR
C#
JavaScript
Python
WebAssembly
LLVM IR
x86 ASM
PE EXE
SDXF Binary
CBOR
Documentation

Everything Is Documented

Deep-dive into each phase of the compiler pipeline with hands-on examples and reference pages.

About

The Developer Behind CDTk

>_
⚠ IDENTITY REDACTED
Unknown_Dev
tristin-porter
Real Name████████████████
Location
Age███████
Employer███████████████
Education████████████████
LanguagesC#, F#, Python, ASM
Compiler Dev PL Researcher Open Source
// About

A systems programmer operating in the shadows of the compiler stack. CDTk is the result of years spent dissecting language runtimes, reverse-engineering binary formats, and pushing the limits of what a .NET toolkit can do.

No affiliation. No employer. No personal details. Just code — clean, fast, and documented.

CDTk is open source because knowledge should be free. If you find it useful, star the repo. If you find a bug, open an issue. If you want to contribute, PRs are welcome.

// Skills
Compiler Design95%
F# / .NET90%
x86 Assembly80%
ML / AI Integration70%
Binary Formats88%
// Project Timeline
v9.0 · 2026
LESS redesign, QUILL ML, .NET 10

Complete website redesign with LESS CSS. Full ML.NET pipeline via QUILL. Upgraded to .NET 10.

v8.x · 2025
CRAB native codegen, SDXF, CBOR tables

x86 PE EXE output. SDXF binary bundle format. CBOR semantic tables.

v7.x · 2024
Multi-language translation, F# core

Round-trip: C# <-> Python <-> JS <-> WASM <-> LLVM IR. F# core UAB pipeline.

v1.0 · 2022
Initial release

First public version with lexer/parser DSL, structural roles, and basic code generation.

Community

What Developers Are Saying

CDTk made writing a multi-target compiler feel like filling in a form. The grammar DSL is genuinely elegant.

A
anon_compiler_dev
PL Researcher

Round-trip C# to WASM to C# with zero data loss? I thought that was impossible. CDTk does it in two lines.

X
0x_wasm_witch
WebAssembly Engineer

The QUILL ML integration is what sold me. Token classification with a pre-trained 128-dim model out of the box.

M
ml_morphism
ML Tooling Dev

Shipping a PE EXE from C# source with no LLVM install? CRAB is incredible. Pure .NET, pure win.

R
rev3rsal
Reverse Engineer

The F# UAB pipeline is beautifully composable. I extended it with a custom grammar in a weekend.

F
fsharp_fanatic
Functional Dev