Parsing a language called "Foo"
with the Pegex toolset.
.-----------------------.
.--------------------. | Pegex::Compiler |
| Foo Language | |-----------------------| Serialize
|--------------------|----->| Pegex::Pegex::Grammar |---------.
| Pegex grammar text | | Pegex::Receiver | |
'--------------------' '-----------------------' v
...................... | .------.
| | | compile() | YAML |
|foo:: <verb> <noun> | v '------'
|verb: /Hello/ | .--------------------. .------.
|noun: /world/ | | Foo grammar tree | | JSON |
| | '--------------------' '------'
...................... | .------.
| | Perl |
v '------'
.---------------------. .--------.
| Pegex::Foo::Grammar | | Python |
|---------------------| '--------'
| Pegex::Parser | .-----.
| Pegex::Foo::AST | | etc |
.-----------------. '---------------------' '-----'
| Foo Language | |
|-----------------|------------------->| parse()
| Foo source text | v
'-----------------' .----------------------.
................... | Parsed Foo Data Tree |
|Hello world | '----------------------'
................... ........................
|- verb: Hello |
|- noun: world |
........................