Line 1: | Line 1: | ||
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 -). | 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 (Flex) Specification == | ||
The lexical analyzer is very simple and limited to recognizing variable names, integers numbers, and the operators themselves. | The lexical analyzer is very simple and limited to recognizing variable names, integers numbers, and the operators themselves. | ||
+ | <text> | ||
+ | </text> | ||
+ | |||
+ | == The Syntactic Analyzer (YACC) Specification == | ||
+ | |||
[[category:Compilers]] | [[category:Compilers]] | ||
[[category:Teaching]] | [[category:Teaching]] |
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. <text> </text>