aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: ebed7d74cb6475a363edc09ca2b8875cc9b378b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# MRY

## 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 `main` if you want to use
> a different one, use the `-e` or `--entry` option.

## Running Benchmark

To run benchmark of your grammar run:

```sh
$ zig build run --release=fast -- benchmark <grammar-file> -i <input-file>
```

Where `<input-file>` contains test-strings on each line.