-
Notifications
You must be signed in to change notification settings - Fork 0
Home
github-actions[bot] edited this page Nov 30, 2025
·
11 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 - JSON command blocks
- 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:
- Pest-compatible grammar syntax - Familiar PEG rules for parsing
- JSON semantic actions - Declarative AST construction
- TypedAST target - A universal, typed intermediate representation
Instead of writing imperative code to build AST nodes, you declare what to build using JSON command blocks attached to grammar rules.
// Grammar rule for integer literals
integer_literal = @{ "-"? ~ ASCII_DIGIT+ }
-> TypedExpression {
"get_text": true,
"parse_int": true,
"define": "int_literal",
"args": { "value": "$result" }
}
This single rule:
- Parses signed integers
- Extracts the matched text
- Converts it to an integer
- Creates a TypedAST literal node