The YACC Parser Generator/Example: Calculator with Variables

From Wiki**3

< The YACC Parser Generator
Revision as of 16:26, 18 April 2008 by Root (talk | contribs) (New page: This example implements a simple calculator. The calculator has an unspecified number of integer variables and the common binary integer operators (namely, addition, subtraction, multiplic...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This example implements a simple calculator. The calculator has an unspecified number of integer variables and the common binary integer operators (namely, addition, subtraction, multiplication, division, and modulus), and unary integer operators (+ and -).

The lexical analyzer is very simple and limited to recognizing variable names, integers numbers, and the operators themselves.