aboutsummaryrefslogtreecommitdiffstats
path: root/src/grammar.pest
diff options
context:
space:
mode:
Diffstat (limited to 'src/grammar.pest')
-rw-r--r--src/grammar.pest15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/grammar.pest b/src/grammar.pest
index 9ef2b1b..822e256 100644
--- a/src/grammar.pest
+++ b/src/grammar.pest
@@ -1,10 +1,9 @@
-WHITESPACE = _{ " " | "\t" }
-COMMENT = _{ "/*" ~ (!"*/" ~ ANY)* ~ "*/" ~ NEWLINE* }
+COMMENT = _{ "#" ~ (!("#" | NEWLINE) ~ ANY)* ~ NEWLINE* }
+WHITESPACE = _{ " " | "\t" | NEWLINE }
program = { SOI ~ statement+ ~ EOI }
-statement = { (definition | expression) ~ NEWLINE* }
-definition = { symbol+ ~ "=" ~ expression }
-expression = { expression_node+ }
-expression_node = { integer_literal | builtin | symbol }
-builtin = { "+" | "-" | "/" | "*" }
+statement = { (definition | expression)}
+definition = { symbol ~ "=" ~ expression ~ ";"+ }
+expression = { (symbol | integer_literal | string_literal | ("(" ~ expression ~ ")"))+ }
integer_literal = @{ "-"? ~ ASCII_DIGIT+ }
-symbol = @{ ASCII_ALPHA ~ (ASCII_ALPHANUMERIC | "-" | ".")* } \ No newline at end of file
+string_literal = { QUOTATION_MARK ~ (!QUOTATION_MARK ~ ANY)* ~ QUOTATION_MARK }
+symbol = @{ (ASCII_ALPHA | "_.") ~ (ASCII_ALPHANUMERIC | "-" | "." | "?" | "!")* }