This project is a parser of the Calc language. It is a program that can examine a string and detect if it respects the syntax of the Calc language, using a context-free parser, and, in such cases, extracts the logical structure of such a string, according to the grammar of the language. Such a structure is often named a syntax tree as it has the shape of a tree, and it represents the syntax of the parsed text.
A syntax tree is an internal data structure, and so usually it is not to be seen by a user, nor to be exported. For debugging purposes, though, this program will pretty-print this data structure to the console.
The program built by this project expects a Calc language file as a command-line argument. In the data folder of the project, there are two example programs—namely, sum.calc and bad_sum.calc.
The first one is sum.calc, given as follows:
@a
@b
>a
>b
<a+b
It declares the two variables a and b, then it asks the user to enter values for them...