Just clone the repository, then do : cargo build
In the idea of Lex/Yacc or Flex/Bison, this program takes a grammar files as an argument and generate a lexical and a syntactic analyzer wich can be embedded in a Rust program.
For now, it handles very simple grammar file which are written as shown below :
number : [0-9]+(\.[0-9]+)?
Expression -> Product '\+' Expression
Expression -> Product '-' Expression
Expression -> Product
Product -> Factor '\*' Product
Product -> Factor '/' Product
Product -> Factor
Factor -> '\(' Expression '\)'
Factor -> number
Note : Test programms are also examples you can base your work on.
Example for the 'expr' test
- Generate the parser code
cargo run test/expr/src/expr.lalr
cd test/expr
- Compile the test
cargo build
- Run it
cargo run
This is in heavy development and should not be used yet
Feedback are always welcomed :)