Last change
on this file since 25584 was 25584, checked in by davidb, 12 years ago |
Initial cut an a text edit area for GLI that supports color syntax highlighting
|
File size:
956 bytes
|
Line | |
---|
1 | /*
|
---|
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
|
---|
5 |
|
---|
6 | http://www.linuxgazette.com/issue39/sevenich.html
|
---|
7 |
|
---|
8 | Small changes and updates to newest JFlex+Cup versions
|
---|
9 | by Gerwin Klein
|
---|
10 | */
|
---|
11 |
|
---|
12 | /*
|
---|
13 | Commented By: Christopher Lopes
|
---|
14 | File Name: Main.java
|
---|
15 | To Create:
|
---|
16 | After the scanner, lcalc.flex, and the parser, ycalc.cup, have been created.
|
---|
17 | > javac Main.java
|
---|
18 |
|
---|
19 | To Run:
|
---|
20 | > java Main test.txt
|
---|
21 | where test.txt is an test input file for the calculator.
|
---|
22 | */
|
---|
23 |
|
---|
24 | import java.io.*;
|
---|
25 |
|
---|
26 | public class Main {
|
---|
27 | static public void main(String argv[]) {
|
---|
28 | /* Start the parser */
|
---|
29 | try {
|
---|
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 */
|
---|
34 | e.printStackTrace();
|
---|
35 | }
|
---|
36 | }
|
---|
37 | }
|
---|
38 |
|
---|
39 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.