summaryrefslogtreecommitdiff
path: root/src/piglet/piglet2spiglet/Main.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/piglet/piglet2spiglet/Main.java')
-rw-r--r--src/piglet/piglet2spiglet/Main.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/piglet/piglet2spiglet/Main.java b/src/piglet/piglet2spiglet/Main.java
new file mode 100644
index 0000000..db68b6a
--- /dev/null
+++ b/src/piglet/piglet2spiglet/Main.java
@@ -0,0 +1,38 @@
+package piglet.piglet2spiglet;
+
+
+import piglet.ParseException;
+import piglet.PigletParser;
+import piglet.TokenMgrError;
+import piglet.syntaxtree.Node;
+import piglet.visitor.GJDepthFirst;
+
+
+public class Main {
+
+ public static void main(String[] args) {
+ try {
+ Node root = new PigletParser(System.in).Goal();
+ /*
+ * TODO: Implement your own Visitors and other classes.
+ *
+ */
+ GJDepthFirst v = new GJDepthFirst<Object,Object>() {
+ };
+ //Traverse the Abstract Grammar Tree
+ root.accept(v,null);
+ }
+ catch(TokenMgrError e){
+ //Handle Lexical Errors
+ e.printStackTrace();
+ }
+ catch (ParseException e){
+ //Handle Grammar Errors
+ e.printStackTrace();
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+} \ No newline at end of file