An expression parser (small DSL) written in C
An expression parser (small DSL) written in C
github.com GitHub - torrentg/expr: An expression parser supporting multiple types
An expression parser supporting multiple types. Contribute to torrentg/expr development by creating an account on GitHub.
Key Features
- Multiple types (number, bool, datetime, string and error)
- Memory managed by user (no allocs)
- Iterator based interface
- Supporting variables
- Stateless
- Expressions can be compiled (RPN stack)
- Fully compile-time checked syntax
- Documented grammar
- Standard C11 code
- No dependencies
Examples
# Numerical calculations sin((-1 + 2) * PI) # Dates datetrunc(now(), "day") # Strings "hi " + upper("bob") + trim(" ! ") # Conditionals ifelse(1 < 5 && length($alphabet) > 25, "case1", "case2") # Find the missing letter replace($alphabet, substr($alphabet, 25 - random(0, length($alphabet)), 1), "")
0
comments