Crate expr_solver

Crate expr_solver 

Source
Expand description

A simple expression solver library

Parses and evaluates mathematical expressions with built-in functions and constants.

§Features

  • Mathematical operators: +, -, *, /, ^, unary -, ! (factorial)
  • Comparison operators: ==, !=, <, <=, >, >= (return 1.0 or 0.0)
  • Built-in constants: pi, e, tau, ln2, ln10, sqrt2
  • Basic math functions: abs, floor, ceil, round, trunc, fract
  • Variadic functions: min, max, sum, avg
  • 128-bit decimal arithmetic (no floating-point representation errors!)
  • Error handling with source location information

Structs§

Eval
IrBuilder
Parser
Program
Executable program is still a sequence of Instr<'sym> referencing symbols inside a provided SymTable.
Sema
Semantic analyzer: resolves identifiers/calls to symbols and checks arity & types.
Source
Source code container with input validation.
SymTable
Symbol table containing constants and functions.
Vm
A simple stack-based virtual machine for evaluating programs.

Enums§

Symbol
What a symbol represents in the language.
SymbolError
Errors that can occur during symbol table operations.
VmError
Virtual machine runtime errors.