diff options
| author | William Hergès <william@herges.fr> | 2025-11-09 13:36:02 +0100 |
|---|---|---|
| committer | William Hergès <william@herges.fr> | 2025-11-09 13:36:02 +0100 |
| commit | 7ddc83f098cfd316656c28dcca5375b939fd6c00 (patch) | |
| tree | ca37624e84a771c8e49d8ae4623e298a9a2b9692 /src/elixir_math_parser.yrl | |
| parent | 3b0cc79dee76244da55d2326cc4244a384d85e44 (diff) | |
feat(calc)): partial supports of exp
Diffstat (limited to 'src/elixir_math_parser.yrl')
| -rw-r--r-- | src/elixir_math_parser.yrl | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/elixir_math_parser.yrl b/src/elixir_math_parser.yrl index 0808683..006c768 100644 --- a/src/elixir_math_parser.yrl +++ b/src/elixir_math_parser.yrl @@ -10,7 +10,7 @@ Terminals int var break - '+' '-' '*' '/' '!' + '+' '-' '*' '/' '!' '^' '=' '(' ')' . @@ -25,7 +25,8 @@ Left 300 '-'. Left 400 '*'. Left 400 '/'. Right 500 '!'. -Left 600 '('. +Left 600 '^'. +Left 700 '('. root -> statements : '$1'. @@ -46,8 +47,9 @@ expr -> exprs '+' exprs : {add_op, '$1', '$3'}. expr -> exprs '-' exprs : {sub_op, '$1', '$3'}. expr -> exprs '*' exprs : {mul_op, '$1', '$3'}. expr -> exprs '/' exprs : {div_op, '$1', '$3'}. -expr -> '(' exprs ')' : '$2'. expr -> expr '!' : {factor_op, '$1'}. +expr -> exprs '^' exprs : {exp_op, '$1', '$3'}. +expr -> '(' exprs ')' : '$2'. Erlang code. |
