Arbitrary-precision Integer Calculator
- Lexer
- Pratt Parser
- Tree-walk interpreter
- Addition +
- Subtraction -
- Multiplication *
- Division /
- Powers (exp function)
- Expressions
2 + 3 * 6 - (2 + 4) //returns 14 - Variables
a = 2 + 3 * 6 //a is now saved as 20 - Function definitions and invocations
myFunction1(x,y,thirdVariable) = x * y + thirdVariable myFunction1(1,2,3) //returns 5
help()- Display quick introduction and usage guideshowVars()- List all currently declared variables and their valuesshowFunctions()- Display all available standard library functions with documentationshowMyFunctions()- List all user-defined functionslexerOutput(0|1)- Toggle lexer tokenization debug outputparserOutput(0|1)- Toggle parser AST debug output
execFile(filename)- Execute another file line by linesave()- Persist current variables and functions to disk (loaded on next startup)clearSave()- Delete the persistent save file
abs(x)- Return absolute value ofxmax(a, b)/min(a, b)- Return maximum/minimum of two valuescmp(a, b)- Compare two values with descriptive output (e.g., "5 is bigger")sum(x, y, ...)- Calculate sum of any number of argumentsprod(x, y, ...)- Calculate product of any number of argumentsmod(a, b)- Return remainder of divisiona / bexp(base, exponent)- Exponentiation (alternative to^operator)cntDigits(x)- Count number of decimal digits inx
inspect(value, [base])- Display internal chunk-level representation of numbers (base 10 or 16)- Example:
inspect(5000000)shows decimal chunk representation from default - Example:
inspect(300, 16)shows hexadecimal chunk representation
- Example:
- Stl grammar correction, using levenshtein distance
mx(1,2) //Output will be: Evaluator error: "mx()" function not found Note: Did you mean max()? - Function info lookup
?max() //displays info about max function //also works for user defined functions like f(x) = 2*x