Basic-Calculator · Expression Parser

A real parser, not a toy.

Tokenizer → recursive-descent parser → AST evaluator. Operator precedence, functions, variables — try it live. Full Python package with 32 tests in the repo. No account, no server: your history and variables stay in your own browser.

›

How it evaluated

Evaluate several lines at once

One expression per line, run top to bottom. Variables carry from line to line, so x = 5 on line 1 works in x^2 on line 2. Click Run all — nothing is sent anywhere; it all runs in your browser.

Supports + - * / ^ %, parentheses, unary minus, sin cos tan asin acos atan log ln sqrt abs floor ceil exp max min round, constants pi e tau, and variables: x = 5 then x^2. ans always holds your last result. Right-associative ^ — so 2^3^2 = 512 and -3^2 = -9. log(x) is the natural log; log(x, base) uses that base. Tap any past expression to reuse it. History and variables are saved in this browser only (localStorage) — clear them above any time.