aboutsummaryrefslogtreecommitdiffstats
path: root/src/grammar.pest
diff options
context:
space:
mode:
Diffstat (limited to 'src/grammar.pest')
-rw-r--r--src/grammar.pest9
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