]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/parser/grammar/input/Grammar.grammar
Moved SCL parser generator to platform repository.
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / parser / grammar / input / Grammar.grammar
diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/parser/grammar/input/Grammar.grammar b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/parser/grammar/input/Grammar.grammar
new file mode 100644 (file)
index 0000000..1d1715f
--- /dev/null
@@ -0,0 +1,23 @@
+initial file ;
+
+file
+    = declaration+                                    # File
+    ;
+
+declaration
+    = NONTERMINAL EQUALS prod (BAR prod)* SEMICOLON   # Production
+    | INITIAL NONTERMINAL SEMICOLON                   # Initial
+    ;
+
+prod
+    = regexps HASH TERMINAL (COMMA (SHIFT|REDUCE) TERMINAL)* # ProductionRhs
+    ;
+
+regexps 
+    = (regexp (regexp | STAR | PLUS | OPTIONAL)*)?         # Concatenation 
+    ;
+
+regexp
+    = (TERMINAL | NONTERMINAL | SHIFT | REDUCE | INITIAL)  # Terminal
+    | LPAREN regexps (BAR regexps)* RPAREN                 # Union
+    ;