JustBash.Arithmetic.Parser (JustBash v0.4.0)
View SourceRecursive descent parser for bash arithmetic expressions.
Parses arithmetic expression strings into AST nodes. Handles operator precedence through the grammar structure:
Expression precedence (lowest to highest):
- Comma (,)
- Ternary (?:)
- Logical OR (||)
- Logical AND (&&)
- Bitwise OR (|)
- Bitwise XOR (^)
- Bitwise AND (&)
- Equality (==, !=)
- Relational (<, <=, >, >=)
- Shift (<<, >>)
- Additive (+, -)
- Multiplicative (*, /, %)
- Power (**)
- Unary (!, ~, -, +, ++, --)
- Postfix (++, --)
- Primary (numbers, variables, groups)
Summary
Functions
Parse an arithmetic expression string into an AST.
Functions
@spec parse(String.t()) :: JustBash.AST.arith_expr()
Parse an arithmetic expression string into an AST.