MRY
IMPORTANT: This project is developed using zig version
0.14.1. Since the zig std is changing between releases it is recommended to use this version.
Grammar Files
The grammar file needs to be in the following format:
main -> expression
expression -> binary_operation | number | '(' expression ')'
binary_operation -> expression binary_operand expression
binary_operand -> '+' | '-' | '*' | '/'
number -> digit number | digit
digit -> '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
Where all terminals are in single-quotes and the rest are non-terminals.
NOTE: The default entry point name is always
mainif you want to use a different one, use the-eor--entryoption.
Running Benchmark
To run benchmark of your grammar run:
$ zig build run --release=fast -- benchmark <grammar-file> -i <input-file>
Where <input-file> contains test-strings on each line.