2
This example comes from a short article series in the Linux
3
Gazette by Richard A. Sevenich and Christopher Lopes, titled
4
"Compiler Construction Tools". The article series starts at
6
http://www.linuxgazette.com/issue39/sevenich.html
8
Small changes and updates to newest JFlex+Cup versions
13
Commented By: Christopher Lopes
16
After the scanner, lcalc.flex, and the parser, ycalc.cup, have been created.
21
where test.txt is an test input file for the calculator.
27
static public void main(String argv[]) {
28
/* Start the parser */
30
parser p = new parser(new Lexer(new FileReader(argv[0])));
31
Object result = p.parse().value;
32
} catch (Exception e) {
33
/* do cleanup here -- possibly rethrow e */