An implementation of a programming-language calculator.
- Arithmetic: +,-,*,/
- Parentheses
- Variables
- Assignment operators: =,+=,-=,*=,/=
- Unary increment/decrement
- In-expression assignments
- Resources
- Main advantages: efficient, relatively simple.
- Main disadvantage: ambiguous unary-binary operators with non-equal precedence is not easily supported.
- NUM:=[0-9]*
- VAR:=[a-z;A-Z]+[a-z;A-Z;0-9]*
- TERMINAL:={NUM|VAR}
- ASSIGN:={VAR}[=,+=,-=,*=,/=]{EXPR}
- EXPR:= ({EXPR}) || ASSIGN || SUM || MUL || DIV || SUB || {VAR}++ || ++{VAR} || {VAR}-- || --{VAR}