diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2021-11-17 09:31:21 +0200 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2021-11-17 09:31:21 +0200 |
| commit | 15f5516b98d3b26eaa9aef758f8e2292b1f4a570 (patch) | |
| tree | 87fbe85ae247d17d0ab5bb8a58f6d9f566785e8d /src/grammar.pest | |
Initial commit
Diffstat (limited to 'src/grammar.pest')
| -rw-r--r-- | src/grammar.pest | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/grammar.pest b/src/grammar.pest new file mode 100644 index 0000000..e930511 --- /dev/null +++ b/src/grammar.pest @@ -0,0 +1,9 @@ +WHITESPACE = _{ " " | "\t" } +COMMENT = _{ "/*" ~ (!"*/" ~ ANY)* ~ "*/" } +program = { SOI ~ statement+ ~ EOI } +statement = { (definition | expression) ~ NEWLINE* } +definition = { symbol+ ~ "=" ~ expression } +expression = { leaf+ } +leaf = { integer_literal | symbol } +integer_literal = @{ "-"? ~ ASCII_DIGIT+ } +symbol = @{ ASCII_ALPHA ~ (ASCII_ALPHANUMERIC | "-" | ".")* }
\ No newline at end of file |
