using javacc to compile
[cdsspec-compiler.git] / grammer / spec-compiler.jj
diff --git a/grammer/spec-compiler.jj b/grammer/spec-compiler.jj
new file mode 100644 (file)
index 0000000..4596088
--- /dev/null
@@ -0,0 +1,44 @@
+/* spec-compiler.jj Grammer definition for the specification */
+
+options {
+       STATIC = false;
+       JAVA_UNICODE_ESCAPE = true;
+}
+
+PARSER_BEGIN(SpecParser)
+package edu.uci.eecs.specCompiler.grammerParser;
+
+       class SpecParser {
+               public static void main(String[] argvs)
+               throws ParseException, TokenMgrError {
+                       SpecParser parser = new SpecParser(System.in);
+                       parser.Start();
+                       System.out.println("Parsing finished!");
+               }
+       }
+PARSER_END(SpecParser)
+
+SKIP : {" " | "\n" | "\r" | "\r\n" | <COMMENT>}
+
+TOKEN :
+{
+       <SPACE: (" " | "\t")+>
+|
+       <COMMENT: <SPACE> "#" (~["\n", "\r"])* ["\n", "\r"]>
+|
+       <HEAD: "/**">
+|
+       <TAIL: "*/">
+|
+       <BEGIN: "@Begin">
+|
+       <END: "@End">
+|
+       
+}
+
+void Start() :
+{}
+{
+       <HEAD> <BEGIN> <END> <TAIL> <EOF>
+}