Module math

Module math 

Source
Expand description

Calculator DSL Module

This module provides a complete calculator that can parse and evaluate a custom DSL with variables, arithmetic operations, and reference-with-modifier syntax.

Structs§

Assign
A single assignment statement (e.g., a = 2)
CalcResult
Result of evaluating a calculator program
Calculator
Calculator engine that parses and evaluates DSL programs
MathOperators
Math operators implementation for the calculator DSL

Enums§

Expr

Functions§

eval_expr
Evaluate an expression in the given environment
parse_program
Parse a calculator DSL program into a list of assignments
run_program
Run a program (list of assignments) and return the final environment