From 787d7fe08d018abb6c12b11d8e00af9e3e0653ec Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sun, 21 Nov 2021 11:05:14 +0200 Subject: Get evaluation working --- src/grammar.pest | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/grammar.pest') diff --git a/src/grammar.pest b/src/grammar.pest index 4fce017..2b6cbfe 100644 --- a/src/grammar.pest +++ b/src/grammar.pest @@ -1,9 +1,9 @@ COMMENT = _{ "#" ~ (!("#" | NEWLINE) ~ ANY)* ~ NEWLINE* } WHITESPACE = _{ " " | "\t" | NEWLINE } program = { SOI ~ statement+ ~ EOI } -statement = { (definition | expression) } -definition = { symbol ~ "=" ~ expression ~ ";"+ } -expression = { (symbol | integer_literal | string_literal | ("(" ~ expression ~ ")"))+ ~ ";" } +statement = { (definition | expression) ~ ";"+ } +definition = { symbol ~ "=" ~ expression } +expression = { (symbol | integer_literal | string_literal | ("(" ~ expression ~ ")"))+ } integer_literal = @{ "-"? ~ ASCII_DIGIT+ } string_literal = { QUOTATION_MARK ~ (!QUOTATION_MARK ~ ANY)* ~ QUOTATION_MARK } symbol = @{ (ASCII_ALPHA | "_.") ~ (ASCII_ALPHANUMERIC | "-" | "." | "?" | "!")* } -- cgit v1.3