Skip to content

Commit 07642e4

Browse files
committed
Add a human friendly grammar.
1 parent 8d5baa9 commit 07642e4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

g4/Ds.g4

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
grammar Ds;
2+
3+
rule_pool
4+
: rule* EOF
5+
;
6+
7+
rule
8+
: term
9+
| term (',' term)* '->' term
10+
;
11+
12+
term
13+
: SYMBOL
14+
| term '(' (term (',' term)*)? ')'
15+
| '(' term ')'
16+
| <assoc=right> ('~' | '!' | '-' | '+' | '&' | '*') term
17+
| term ('*' | '/' | '%') term
18+
| term ('+' | '-') term
19+
| term ('<<' | '>>') term
20+
| term ('<' | '>' | '<=' | '>=') term
21+
| term ('==' | '!=') term
22+
| term '&' term
23+
| term '^' term
24+
| term '|' term
25+
| term '&&' term
26+
| term '||' term
27+
;
28+
29+
WHITESPACE
30+
: [ \t\r\n]+ -> skip
31+
;
32+
33+
SYMBOL
34+
: ~[ \t\r\n,()]+
35+
;

0 commit comments

Comments
 (0)