Metamorf is a language engineering platform. You describe a complete programming language in a single .mor file. Tokens, types, grammar rules, semantic analysis, and C++23 code generation. Metamorf reads that file, populates dispatch tables, and uses them to compile source files to native Win64/Linux64 binaries via Zig/Clang.
Most language definition tools (YACC, ANTLR, traditional BNF grammars) give you a declarative grammar and then punt to a host language for anything non-trivial. Metamorf is a complete, unified compiler-construction language. Variables, loops, conditionals, recursion, string operations, and user-defined routines are first-class constructs alongside declarative grammar rules and token definitions.
No host language glue code. No build system integration. No escape hatch to C, Java, or Python.
Turing complete by design. The .mor language has variables, loops, conditionals, recursion, and string operations as first-class constructs alongside declarative grammar rules. Every handler body uses the same unified language. No escape hatch to a host language. A .mor file is a complete, self-contained language specification.
Metamorf -l pascal.mor -s hello.pas -r
Metamorf compiles in a single pass through a table-driven pipeline. The .mor file is parsed first, and its contents populate dispatch tables. These tables then drive lexing, parsing, semantic analysis, and code generation of your user source files.
.mor file is parsed by a dedicated lexer and parser. The interpreter walks the AST and populates dispatch tables with your tokens, grammar rules, semantic handlers, and emitters.The .mor language has variables, assignment, unbounded loops, conditionals, arithmetic, string operations, and user-defined routines with recursion. These aren't a separate scripting layer bolted onto a grammar DSL. They're the same unified language surface. Declarative grammar rules and imperative logic are first-class peers.
grammar { // Prefix rule: identifiers rule expr.ident { consume identifier -> @name; } // Infix rule with precedence rule expr.add precedence left 20 { consume [op.plus, op.minus] -> @operator; parse expr -> @right; } // Statement rule with imperative logic inside rule stmt.if { expect keyword.if; parse expr -> @condition; expect keyword.then; parse many stmt until [keyword.else, keyword.end] -> @then_body; optional { expect keyword.else; parse many stmt until keyword.end -> @else_body; } expect keyword.end; } }
emitters { on stmt.var_decl { let i = 0; let n = child_count(); while i < n { let v = getChild(node, i); let ctype = resolveType(getAttr(v, "vtype")); let vname = getAttr(v, "vname"); declVar(vname, ctype); i = i + 1; } } on stmt.for { let varName = getAttr(node, "var"); let startExpr = exprToString(getChild(node, 0)); let finishExpr = exprToString(getChild(node, 1)); forStmt(varName, startExpr, varName + " <= " + finishExpr, varName + "++"); emitBlock(getChild(node, 2)); endFor(); } }
Traditional tools split your language across files, frameworks, and host languages. Metamorf keeps it all in one place.
| Capability | YACC / Bison | ANTLR | Metamorf |
|---|---|---|---|
| Grammar definition | ✓ | ✓ | ✓ |
| Semantic analysis | Host language | Host language | Built-in |
| Code generation | Host language | Host language | IR builders |
| Turing complete logic | Via C/C++ | Via Java/Python | Native |
| Single-file definition | No | No | Yes |
| Native binary output | Manual | Manual | Automatic |
.mor file is a complete, portable language specification..mor.func(), declVar(), ifStmt(). Not string concatenation..mor file.tests/pascal.mor for a working example.System requirements:
| Host OS | Windows 10/11 x64 |
| Linux target | WSL2 + Ubuntu |
| Build from source | Delphi 12 Athens or later |
Metamorf is built in the open. Whether you're fixing a bug, building a showcase language, or just curious, you're welcome.