Skip to content

Files

Latest commit

104bf6c · Apr 2, 2021

History

History
This branch is 1803 commits behind antlr/grammars-v4:master.

calculator

Calculator Grammar

A simple ANTLR4 calculator grammar based on the khubla.com arithmetic grammar.

The calculator example is intended as an example of how to parse arithmetic, geometric and algebraic equations with ANTLR.

Currently supported are:

  • Basic arithmetic respecting order of operations and parenthesis
  • Variables
  • Scientific numbers with "e" notation
  • A small number of trigonometric and logarithmic functions including exponentiation, cos, ln, etc.
  • The constants "e", "pi" and "i"