A general-purpose parser generator that converts a grammar description for an extended PEG into a Ruby program to parse that grammar.
See peg2rb - User Guide.html (view online) for details on the input grammar description and the output parser. You may also see samples of the grammar descriptions in samples.
The input grammar description has its own grammar too. It is described in peg2rb.peg.
You may run this program with the following command of Bourne shell or Command Prompt:
ruby peg2rb.rb input-grammar > output-parser
where input-grammar
is a file with the input grammar description and output-parser
is a file which the output parser is to be written to.
The program exits with status 0 if the parser is generated successfully and with non-zero status otherwise.
Source code for peg2rb.rb. You may use peg2rb.rb on it to generate peg2rb.rb itself.
Script for Rake for building this package.
Tasks planned to be done for this package.
All generated files—generated parsers, object files, temporary assets—are put into this directory.
Formal proof of this package correctness. Not done yet.
Sample grammar descriptions for peg2rb.rb, scripts to generate and run parsers from them and sample input data for the parsers.
Install Rake and run following command in this directory:
rake