File: main.htm

package info (click to toggle)
lg-issue41 1-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,724 kB
  • ctags: 156
  • sloc: makefile: 36; ansic: 8; sh: 4
file content (46 lines) | stat: -rw-r--r-- 1,891 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
   <META NAME="GENERATOR" CONTENT="Mozilla/4.06 [en] (X11; I; Linux 2.0.34 i686) [Netscape]">
</HEAD>
<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#551A8B" ALINK="#FF0000">
/*
<BR>Commented By: Christopher Lopes
<BR>File Name: Main.java
<BR>To Create: After the scanner, lcalc.flex, and the parser, ycalc.cup,
have been
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; created.
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> javac Main.java
<BR>To Run: > java Main test.txt
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
where test.txt is an test input file for the calculator.
<BR>*/
<P>/* Import classes needed.&nbsp; The class we created for the parser,
the standard
<BR>&nbsp;&nbsp; runtime class for java, and an io class.*/
<BR><B>import parser;</B>
<BR><B>import java_cup.runtime.Symbol;</B>
<BR><B>import java.io.*;</B>
<P><B>class Main {</B>
<P>&nbsp; static boolean do_debug_parse = false;
<BR>&nbsp; static public void main(String argv[]) {
<P>&nbsp; /* Start the parser */
<BR>&nbsp; try {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parser p = new parser(new Lexer(new
FileReader(argv[0])));
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Object result = p.parse().value;
<BR>&nbsp;
<P>&nbsp;&nbsp;&nbsp; } catch (Exception e) {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* do cleanup here -- possibly rethrow
e */
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } finally {
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* do close out here */
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
<BR>&nbsp; }
<BR><B>}</B><B></B>
<P><B>/*&nbsp;</B> <A HREF="lopes.html#main">Return to Main for our Calculator</A>&nbsp;
*/
</BODY>
</HTML>