Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 703 Bytes

File metadata and controls

48 lines (32 loc) · 703 Bytes

Expression Parser

Top down parser for parsing expressions into abstract syntax tree for arithmetic expressions.

Following operators allowed

  • Numbers - Int only!(for now)
  • Normal Operators - +, -, *, /
  • If/Else - if('value' <|>|= 'value', 'whenTrue', 'whenFalse')
  • Braces - ()
  • Log - log(number, base)
  • Natural Logarithm - ln(number)

Example expression

98+if(log(56*3,32) > 98, 845*32,ln(37))

Prerequisites

You need to have g++ installed.

Installing

Clone repo

https://github.com/ivo96/expression-parser.git

Change permissions

chmod +x ./compile.bash

Compile

./compile.bash

Run the executable

./bin/calculator