Skip to content

Latest commit

 

History

History
11 lines (7 loc) · 577 Bytes

File metadata and controls

11 lines (7 loc) · 577 Bytes

Arithmetic Interpreter

Arithmetic Interpreter is a syntax-directed interpreter to interpret basic Math expressions.

Syntax Directed Interpreters are interpreters that evaluate an expression while preforming the syntax analysis using context free grammer (CFG) rules. They directly parse the source code and execute them , without generation any intermediate code.

Arthin uses three grammer rules to parse any arithmetic expression.

  • expr → term ((PLUS | MINUS) term) *
  • term → factor ((MUL | DIV) factor) *
  • factor → INTEGER | (LPAREN expr RPAREN) *