DSL Demo Examples
Each phase of the DSL roadmap introduces languages built for a specific domain: grammars, macros, hardware, intermediate representations, GPU kernels, statistics, and constraint solvers. Click View to inspect each annotated snippet in the code viewer.
For open-source compiler and DSL codebases to study at scale, see Study Projects; for official installers and browser playgrounds, see References & Downloads.
Implementation Languages (Phase 3)
Languages and grammar tools used to build parsers, compilers, and embedded DSLs.
| # | Language | Description | Link |
|---|---|---|---|
| 1 | ANTLR 4 | Expression grammar with operator precedence and labeled AST alternatives. | View |
| 2 | Racket | Hygienic syntax-rules macro defining a declarative rule-matching DSL. | View |
| 3 | OCaml | Algebraic data type and exhaustive pattern-matching evaluator for a small AST. | View |
Execution Models (Phase 4)
Low-level assemblers, hardware description languages, and compiler intermediate representations.
| # | Language | Description | Link |
|---|---|---|---|
| 4 | FASM | Flat assembler macro expanding into a 64-bit Linux syscall sequence. | View |
| 5 | Verilog | 4-bit synchronous up-counter with reset and enable using non-blocking flip-flop assignments. | View |
| 6 | LLVM IR | Static Single Assignment (SSA) loop using phi nodes to sum 1..n. | View |
AI & Scientific DSLs (Phases 5–6)
Domain-specific languages for GPU kernels, multiple dispatch, and statistical modeling.
| # | Language | Description | Link |
|---|---|---|---|
| 7 | Triton | Block-tiled GPU vector addition kernel with boundary masking. | View |
| 8 | Julia | Multiple dispatch over an abstract type hierarchy with vectorized broadcasting. | View |
| 9 | R | Data-frame subsetting and linear regression over the built-in mtcars dataset. | View |
Logic & Symbolic Languages (Phase 7)
Declarative rules, answer-set constraints, and Lisp-family data pipelines.
| # | Language | Description | Link |
|---|---|---|---|
| 10 | Prolog | Facts and recursive reachability rules over a directed graph. | View |
| 11 | Clingo (ASP) | Answer Set Programming choice rules and constraints for 3-coloring a graph. | View |
| 12 | Clojure | Immutable data transformation pipeline using the ->> threading macro. | View |
Practice move: open the ANTLR grammar alongside the OCaml evaluator and trace how a parsed expression tree lowers to an algebraic type and evaluates.