Commit 726b2e7
committed
feat: implement ZynPEG 2.0 Phase 1 - grammar IR and runtime
Phase 1 of the new PEG implementation with named bindings:
Grammar IR (crates/zyn_peg/src/grammar/):
- GrammarIR: Complete grammar representation with metadata
- PatternIR: Patterns with named bindings (name:identifier syntax)
- ActionIR: Semantic actions (Construct, HelperCall, PassThrough)
- ExprIR: Action expressions for AST construction
- Hand-written recursive descent parser for .zyn files
Runtime (crates/zyn_peg/src/runtime2/):
- ParserState: Position tracking, arena integration, bindings
- MemoCache: Packrat memoization for O(n) parsing
- Combinators: literal, optional, choice, sequence, repeat, etc.
This replaces the fragile positional $N captures with named bindings
and lays foundation for direct TypedAST code generation.1 parent 93c21bc commit 726b2e7
8 files changed
Lines changed: 3156 additions & 0 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
0 commit comments