svn:ignore set on bottomup directory, added Evaluator
git-svn-id: svn://anubis/gvsu@111 45c1a28c-8058-47b2-ae61-ca45b979098e
This commit is contained in:
parent
98bce7f896
commit
64396d1559
@ -4,3 +4,7 @@ all: sablecc
|
||||
.PHONY: sablecc
|
||||
sablecc:
|
||||
sablecc arithmetic.grammar
|
||||
|
||||
.PHONY: run
|
||||
run:
|
||||
java jholtrop.gvsu.cs675.bottomup.Evaluator
|
||||
|
29
cs675/bottomup/jholtrop/gvsu/cs675/bottomup/Evaluator.java
Normal file
29
cs675/bottomup/jholtrop/gvsu/cs675/bottomup/Evaluator.java
Normal file
@ -0,0 +1,29 @@
|
||||
|
||||
package jholtrop.gvsu.cs675.bottomup;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
public class Evaluator
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
Evaluator e = new Evaluator();
|
||||
e.evaluate();
|
||||
}
|
||||
|
||||
void evaluate()
|
||||
{
|
||||
try
|
||||
{
|
||||
System.out.println("Enter an expression to evaluate");
|
||||
Parser p = new Parser(new Lexer(new PushbackReader(
|
||||
new InputStreamReader(System.in), 1024)));
|
||||
|
||||
Start tree = p.parse();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user