-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
github-actions[bot] edited this page Feb 27, 2026
·
12 revisions
A comprehensive guide to building language frontends with ZynPEG.
- Introduction - What is Zyn and why use it?
- Getting Started - Your first Zyn grammar
- Using the CLI - Compilation, execution, and REPL
- Grammar Syntax - PEG-based grammar rules
- Semantic Actions - TypedAST action expressions
- The TypedAST - Understanding the target representation
- TypedAST Builder - Building AST nodes programmatically
- Complete Example: Zig - A real-world grammar walkthrough
- Reference - Command reference and API
- Packaging & Distribution - ZPack format, AOT linking, and distribution
- HIR Builder - Building HIR directly for custom backends
- Embedding SDK - Embedding Zyntax in Rust applications with native calling
- Async Runtime - Promise-based async native runtime
- Runtime Plugins - ZRTL standard library plugins (I/O, FS, Net, Thread, etc.)
- Building DSLs - Creating domain-specific languages with Zyntax
- Tutorial: Image Pipeline DSL - Step-by-step DSL tutorial with working example
# Build zyntax
cargo build --release
# Compile and run a Zig file using the zig.zyn grammar
./target/release/zyntax compile \
--grammar crates/zyn_peg/grammars/zig.zyn \
--source examples/hello.zig \
--run
# Start an interactive REPL
./target/release/zyntax repl --grammar crates/zyn_peg/grammars/zig.zynZyn is a Parser Expression Grammar (PEG) system that combines:
- Packrat-memoized PEG parsing - O(n) parsing with named bindings
- TypedAST semantic actions - Direct AST construction at parse time
- TypedAST target - A universal, typed intermediate representation
Instead of writing imperative code to build AST nodes, you write typed construct expressions that mirror Rust struct/enum syntax:
// Atomic rule (@) captures matched text automatically via the binding name
integer_literal = @{ "-"? ~ ASCII_DIGIT+ }
-> TypedExpression::IntLiteral { value: integer_literal }
This single rule:
- Parses signed integers
- Captures the matched text automatically (no
get_textneeded) - Constructs a
TypedExpression::IntLiteralnode directly