philpoore / Math

Just a little math interpreter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Math

C/C++ CI

Just a simple math interpreter.

Build

make

Run

** Command line input:**

$ math "10+23"
33

** File input: **

& cat test.math
10+23
$ math -f test.math
33

** As REPL: **

$ math
> 10+23
33
> 45 + 45
90

Todo list / Features

  • Numbers (double by default)
  • Basic Math Operators (+ - * / % **)
  • Basic Math functions (currently only uniary functions; take one arg, return one arg)
    • trigonomic functions (sin, cos, tan, acos, asin, atan)
    • Logorythmic functions (log, log2, log10, exp, exp2)
    • Others
  • Global constants (PI)
  • Variable Assignment (a=10+10)
  • Examples folder
  • Better readme
  • Requirements in readme
  • Getting started guide.
  • Allow file input e.g "math file.math"
  • More operators (+= -=, boolean && ||, logic)
  • Comments (single line //, and multi line /.../)
  • if / else
  • loops (while, for)
  • Custom Functions
  • AST optimizations
  • Nicer error handling
  • Other Types
    • strings
    • arrays
    • bool
  • Better testing system

Potential Features

  • Code / Binary generation
  • LLVM backend

Testing

Tests are arranged in test/ folder.

make check

Requirements

  • g++
  • make
  • cpp std:lib
  • clang-format for formatting
  • node.js for fuzz test generation

Development

Pull requests and bug reports welcome.

About

Just a little math interpreter


Languages

Language:C++ 91.9%Language:Shell 6.6%Language:Makefile 1.4%