diff options
| author | William Hergès <william@herges.fr> | 2025-11-08 22:53:41 +0100 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-11-08 22:53:41 +0100 |
| commit | c7a26d3c6125caa9239cec9bf08db935d98e19c1 (patch) | |
| tree | 77222ae3903da80d619d7a33d307d0d46c4eb9bb /src | |
| parent | f52f066e7cf6b4c96e452a8f7e803d7f1895e9a1 (diff) | |
feat(syntax): eval statement
Diffstat (limited to 'src')
| -rw-r--r-- | src/elixir_math_parser.yrl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/elixir_math_parser.yrl b/src/elixir_math_parser.yrl index 3ec4946..17b46ad 100644 --- a/src/elixir_math_parser.yrl +++ b/src/elixir_math_parser.yrl @@ -31,11 +31,12 @@ Left 600 '('. root -> statements : '$1'. -statements -> statement : '$1'. -statements -> statement statements : lists:merge('$1', '$2'). -statements -> statement ';;' statements : lists:merge('$1', '$3'). +statements -> statement : ['$1']. +statements -> statement statements : ['$1'|'$2']. +statements -> statement ';;' statements : ['$1'|'$3']. -statement -> atom '=' expr : [{assign, '$1', '$3'}]. +statement -> atom '=' expr : {assign, '$1', '$3'}. +statement -> expr : {eval, '$1'}. expr -> int : unwrap('$1'). expr -> atom : '$1'. |
