-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgrammar.html
163 lines (160 loc) · 26.7 KB
/
grammar.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
---
layout: main
---
<div class="page-header">
<h1>Grammar</h1>
</div>
<p>Here you can find the grammar for the Gosu programming language.
The grammar below uses the following EBNF-style conventions:
<ul>
<li> [x] denotes zero or one occurrences of x.
<li> {x} denotes zero or more occurrences of x.
<li> x | y means one of either x or y.
</ul></p>
<p>For more information on this EBNF notation please refer to this wiki
<a href="https://en.wikipedia.org/wiki/Wirth_syntax_notation">page</a>.</p>
<p>An ANTLR v3.x based grammar can be found
<a href="https://github.com/gosu-lang/gosu-lang/blob/master/gosu-core/src/main/java/gw/internal/gosu/parser/ebnf">here</a>.</p>
<pre>
<b>start</b> <b>=</b> header modifiers <b>(</b>gClass <b>|</b> gInterface <b>|</b> gEnum <b>|</b> gEnhancement<b>)</b> <b>.</b>
<b>header</b> <b>=</b> <b>[</b><font color="green">"package"</font> namespaceStatement<b>]</b> <b>[</b>usesStatementList<b>]</b> <b>.</b>
<b>annotation</b> <b>=</b> <font color="green">"@"</font> idAll <b>{</b><font color="green">"."</font> idAll<b>}</b> <b>[</b>typeVariableDefs annotationArguments<b>]</b> <b>.</b>
<b>gClass</b> <b>=</b> <font color="green">"class"</font> id typeVariableDefs <b>[</b><font color="green">"extends"</font> classOrInterfaceType<b>]</b> <b>[</b><font color="green">"implements"</font> classOrInterfaceType <b>{</b><font color="green">","</font> classOrInterfaceType<b>}</b><b>]</b> classBody <b>.</b>
<b>gInterface</b> <b>=</b> <font color="green">"interface"</font> id typeVariableDefs <b>[</b><b>(</b><font color="green">"extends"</font> <b>|</b> <font color="green">"implements"</font><b>)</b> classOrInterfaceType <b>{</b><font color="green">","</font> classOrInterfaceType<b>}</b><b>]</b> interfaceBody <b>.</b>
<b>gEnum</b> <b>=</b> <font color="green">"enum"</font> id typeVariableDefs <b>[</b><font color="green">"implements"</font> classOrInterfaceType <b>{</b><font color="green">","</font> classOrInterfaceType<b>}</b><b>]</b> enumBody <b>.</b>
<b>gEnhancement</b> <b>=</b> <font color="green">"enhancement"</font> id typeVariableDefs <font color="green">":"</font> classOrInterfaceType <b>{</b><font color="green">"["</font> <font color="green">"]"</font><b>}</b> enhancementBody <b>.</b>
<b>classBody</b> <b>=</b> <font color="green">"{"</font> classMembers <font color="green">"}"</font> <b>.</b>
<b>enhancementBody</b> <b>=</b> <font color="green">"{"</font> enhancementMembers <font color="green">"}"</font> <b>.</b>
<b>interfaceBody</b> <b>=</b> <font color="green">"{"</font> interfaceMembers <font color="green">"}"</font> <b>.</b>
<b>enumBody</b> <b>=</b> <font color="green">"{"</font> <b>[</b>enumConstants<b>]</b> classMembers <font color="green">"}"</font> <b>.</b>
<b>enumConstants</b> <b>=</b> enumConstant <b>{</b><font color="green">","</font> enumConstant<b>}</b> <b>[</b><font color="green">","</font><b>]</b> <b>[</b><font color="green">";"</font><b>]</b> <b>.</b>
<b>enumConstant</b> <b>=</b> <b>{</b>annotation<b>}</b> id optionalArguments <b>.</b>
<b>interfaceMembers</b> <b>=</b> <b>{</b>modifiers <b>(</b>functionDefn <b>|</b> propertyDefn <b>|</b> fieldDefn <b>|</b> gClass <b>|</b> gInterface <b>|</b> gEnum<b>)</b> <b>[</b><font color="green">";"</font><b>]</b><b>}</b> <b>.</b>
<b>classMembers</b> <b>=</b> <b>{</b>declaration<b>}</b> <b>.</b>
<b>declaration</b> <b>=</b> modifiers <b>(</b>functionDefn <b>[</b>functionBody<b>]</b> <b>|</b> constructorDefn functionBody <b>|</b> propertyDefn <b>[</b>functionBody<b>]</b> <b>|</b> fieldDefn <b>|</b> delegateDefn <b>|</b> gClass <b>|</b> gInterface <b>|</b> gEnum<b>)</b> <b>[</b><font color="green">";"</font><b>]</b> <b>.</b>
<b>enhancementMembers</b> <b>=</b> <b>{</b>modifiers <b>(</b>functionDefn functionBody <b>|</b> propertyDefn functionBody<b>)</b> <b>[</b><font color="green">";"</font><b>]</b><b>}</b> <b>.</b>
<b>delegateDefn</b> <b>=</b> <font color="green">"delegate"</font> id delegateStatement <b>.</b>
<b>delegateStatement</b> <b>=</b> <b>[</b><font color="green">":"</font> typeLiteral<b>]</b> <font color="green">"represents"</font> typeLiteral <b>{</b><font color="green">","</font> typeLiteral<b>}</b> <b>[</b><font color="green">"="</font> expression<b>]</b> <b>.</b>
<b>optionalType</b> <b>=</b> <b>[</b><font color="green">":"</font> typeLiteral <b>|</b> blockTypeLiteral<b>]</b> <b>.</b>
<b>fieldDefn</b> <b>=</b> <font color="green">"var"</font> id optionalType <b>[</b><font color="green">"as"</font> <b>[</b><font color="green">"readonly"</font><b>]</b> id<b>]</b> <b>[</b><font color="green">"="</font> expression<b>]</b> <b>.</b>
<b>propertyDefn</b> <b>=</b> <font color="green">"property"</font> <b>(</b><font color="green">"get"</font> <b>|</b> <font color="green">"set"</font><b>)</b> id parameters <b>[</b><font color="green">":"</font> typeLiteral<b>]</b> <b>.</b>
<b>dotPathWord</b> <b>=</b> id <b>{</b><font color="green">"."</font> id<b>}</b> <b>.</b>
<b>namespaceStatement</b> <b>=</b> dotPathWord <b>{</b><font color="green">";"</font><b>}</b> <b>.</b>
<b>usesStatementList</b> <b>=</b> <font color="green">"uses"</font> usesStatement <b>{</b><font color="green">"uses"</font> usesStatement<b>}</b> <b>.</b>
<b>usesStatement</b> <b>=</b> dotPathWord <b>[</b><font color="green">"."</font> <font color="green">"*"</font><b>]</b> <b>{</b><font color="green">";"</font><b>}</b> <b>.</b>
<b>typeVariableDefs</b> <b>=</b> <b>[</b><font color="green">"<"</font> typeVariableDefinition <b>{</b><font color="green">","</font> typeVariableDefinition<b>}</b> <font color="green">">"</font><b>]</b> <b>.</b>
<b>typeVariableDefinition</b> <b>=</b> id <b>[</b><font color="green">"extends"</font> typeLiteralList<b>]</b> <b>.</b>
<b>functionBody</b> <b>=</b> statementBlock <b>.</b>
<b>parameters</b> <b>=</b> <font color="green">"("</font> <b>[</b>parameterDeclarationList<b>]</b> <font color="green">")"</font> <b>.</b>
<b>functionDefn</b> <b>=</b> <font color="green">"function"</font> id typeVariableDefs parameters <b>[</b><font color="green">":"</font> typeLiteral<b>]</b> <b>.</b>
<b>constructorDefn</b> <b>=</b> <font color="green">"construct"</font> parameters <b>[</b><font color="green">":"</font> typeLiteral<b>]</b> <b>.</b>
<b>modifiers</b> <b>=</b> <b>{</b>annotation <b>|</b> <font color="green">"private"</font> <b>|</b> <font color="green">"internal"</font> <b>|</b> <font color="green">"protected"</font> <b>|</b> <font color="green">"public"</font> <b>|</b> <font color="green">"static"</font> <b>|</b> <font color="green">"abstract"</font> <b>|</b> <font color="green">"override"</font> <b>|</b> <font color="green">"final"</font> <b>|</b> <font color="green">"transient"</font><b>}</b> <b>.</b>
<b>statement</b> <b>=</b> <b>(</b>ifStatement <b>|</b> tryCatchFinallyStatement <b>|</b> throwStatement <b>|</b> <font color="green">"continue"</font> <b>|</b> <font color="green">"break"</font> <b>|</b> returnStatement <b>|</b> forEachStatement <b>|</b> whileStatement <b>|</b> doWhileStatement <b>|</b> switchStatement <b>|</b> usingStatement <b>|</b> assertStatement <b>|</b> <font color="green">"final"</font> localVarStatement <b>|</b> localVarStatement <b>|</b> evalExpr <b>|</b> assignmentOrMethodCall <b>|</b> statementBlock<b>)</b> <b>[</b><font color="green">";"</font><b>]</b> <b>|</b> <font color="green">";"</font> <b>.</b>
<b>ifStatement</b> <b>=</b> <font color="green">"if"</font> <font color="green">"("</font> expression <font color="green">")"</font> statement <b>[</b><font color="green">";"</font><b>]</b> <b>[</b><font color="green">"else"</font> statement<b>]</b> <b>.</b>
<b>tryCatchFinallyStatement</b> <b>=</b> <font color="green">"try"</font> statementBlock <b>(</b>catchClause <b>{</b>catchClause<b>}</b> <b>[</b><font color="green">"finally"</font> statementBlock<b>]</b> <b>|</b> <font color="green">"finally"</font> statementBlock<b>)</b> <b>.</b>
<b>catchClause</b> <b>=</b> <font color="green">"catch"</font> <font color="green">"("</font> <b>[</b><font color="green">"var"</font><b>]</b> id <b>[</b><font color="green">":"</font> typeLiteral<b>]</b> <font color="green">")"</font> statementBlock <b>.</b>
<b>assertStatement</b> <b>=</b> <font color="green">"assert"</font> expression <b>[</b><font color="green">":"</font> expression<b>]</b> <b>.</b>
<b>usingStatement</b> <b>=</b> <font color="green">"using"</font> <font color="green">"("</font> <b>(</b>localVarStatement <b>{</b><font color="green">","</font> localVarStatement<b>}</b> <b>|</b> expression<b>)</b> <font color="green">")"</font> statementBlock <b>[</b><font color="green">"finally"</font> statementBlock<b>]</b> <b>.</b>
<b>returnStatement</b> <b>=</b> <font color="green">"return"</font> <b>[</b>expression<b>]</b> <b>.</b>
<b>whileStatement</b> <b>=</b> <font color="green">"while"</font> <font color="green">"("</font> expression <font color="green">")"</font> statement <b>.</b>
<b>doWhileStatement</b> <b>=</b> <font color="green">"do"</font> statement <font color="green">"while"</font> <font color="green">"("</font> expression <font color="green">")"</font> <b>.</b>
<b>switchStatement</b> <b>=</b> <font color="green">"switch"</font> <font color="green">"("</font> expression <font color="green">")"</font> <font color="green">"{"</font> <b>{</b>switchBlockStatementGroup<b>}</b> <font color="green">"}"</font> <b>.</b>
<b>switchBlockStatementGroup</b> <b>=</b> <b>(</b><font color="green">"case"</font> expression <font color="green">":"</font> <b>|</b> <font color="green">"default"</font> <font color="green">":"</font><b>)</b> <b>{</b>statement<b>}</b> <b>.</b>
<b>throwStatement</b> <b>=</b> <font color="green">"throw"</font> expression <b>.</b>
<b>localVarStatement</b> <b>=</b> <font color="green">"var"</font> id optionalType <b>[</b><font color="green">"="</font> expression<b>]</b> <b>.</b>
<b>forEachStatement</b> <b>=</b> <b>(</b><font color="green">"foreach"</font> <b>|</b> <font color="green">"for"</font><b>)</b> <font color="green">"("</font> <b>(</b>expression <b>[</b>indexVar<b>]</b> <b>|</b> <b>[</b><font color="green">"var"</font><b>]</b> id <font color="green">"in"</font> expression <b>[</b>indexRest<b>]</b><b>)</b> <font color="green">")"</font> statement <b>.</b>
<b>indexRest</b> <b>=</b> indexVar iteratorVar <b>|</b> iteratorVar indexVar <b>|</b> indexVar <b>|</b> iteratorVar <b>.</b>
<b>indexVar</b> <b>=</b> <font color="green">"index"</font> id <b>.</b>
<b>iteratorVar</b> <b>=</b> <font color="green">"iterator"</font> id <b>.</b>
<b>thisSuperExpr</b> <b>=</b> <font color="green">"this"</font> <b>|</b> <font color="green">"super"</font> <b>.</b>
<b>assignmentOrMethodCall</b> <b>=</b> <b>(</b><b>(</b>newExpr <b>|</b> thisSuperExpr <b>|</b> typeLiteralExpr <b>|</b> parenthExpr <b>|</b> StringLiteral<b>)</b> indirectMemberAccess<b>)</b> <b>[</b>incrementOp <b>|</b> assignmentOp expression<b>]</b> <b>.</b>
<b>statementBlock</b> <b>=</b> statementBlockBody <b>.</b>
<b>statementBlockBody</b> <b>=</b> <font color="green">"{"</font> <b>{</b>statement<b>}</b> <font color="green">"}"</font> <b>.</b>
<b>blockTypeLiteral</b> <b>=</b> blockLiteral <b>.</b>
<b>blockLiteral</b> <b>=</b> <font color="green">"("</font> <b>[</b>blockLiteralArg <b>{</b><font color="green">","</font> blockLiteralArg<b>}</b><b>]</b> <font color="green">")"</font> <b>[</b><font color="green">":"</font> typeLiteral<b>]</b> <b>.</b>
<b>blockLiteralArg</b> <b>=</b> id <b>(</b><font color="green">"="</font> expression <b>|</b> blockTypeLiteral<b>)</b> <b>|</b> <b>[</b>id <font color="green">":"</font><b>]</b> typeLiteral <b>[</b><font color="green">"="</font> expression<b>]</b> <b>.</b>
<b>typeLiteral</b> <b>=</b> type <b>{</b><font color="green">"&"</font> type<b>}</b> <b>.</b>
<b>typeLiteralType</b> <b>=</b> typeLiteral <b>.</b>
<b>typeLiteralExpr</b> <b>=</b> typeLiteral <b>.</b>
<b>typeLiteralList</b> <b>=</b> typeLiteral <b>.</b>
<b>type</b> <b>=</b> classOrInterfaceType <b>{</b><font color="green">"["</font> <font color="green">"]"</font><b>}</b> <b>|</b> <font color="green">"block"</font> blockLiteral <b>.</b>
<b>classOrInterfaceType</b> <b>=</b> idclassOrInterfaceType typeArguments <b>{</b><font color="green">"."</font> id typeArguments<b>}</b> <b>.</b>
<b>typeArguments</b> <b>=</b> <b>[</b><font color="green">"<"</font> typeArgument <b>{</b><font color="green">","</font> typeArgument<b>}</b> <font color="green">">"</font><b>]</b> <b>.</b>
<b>typeArgument</b> <b>=</b> typeLiteralType <b>|</b> <font color="green">"?"</font> <b>[</b><b>(</b><font color="green">"extends"</font> <b>|</b> <font color="green">"super"</font><b>)</b> typeLiteralType<b>]</b> <b>.</b>
<b>expression</b> <b>=</b> conditionalExpr <b>.</b>
<b>conditionalExpr</b> <b>=</b> conditionalOrExpr <b>[</b><font color="green">"?"</font> conditionalExpr <font color="green">":"</font> conditionalExpr <b>|</b> <font color="green">"?:"</font> conditionalExpr<b>]</b> <b>.</b>
<b>conditionalOrExpr</b> <b>=</b> conditionalAndExpr <b>{</b>orOp conditionalAndExpr<b>}</b> <b>.</b>
<b>conditionalAndExpr</b> <b>=</b> bitwiseOrExpr <b>{</b>andOp bitwiseOrExpr<b>}</b> <b>.</b>
<b>bitwiseOrExpr</b> <b>=</b> bitwiseXorExpr <b>{</b><font color="green">"|"</font> bitwiseXorExpr<b>}</b> <b>.</b>
<b>bitwiseXorExpr</b> <b>=</b> bitwiseAndExpr <b>{</b><font color="green">"^"</font> bitwiseAndExpr<b>}</b> <b>.</b>
<b>bitwiseAndExpr</b> <b>=</b> equalityExpr <b>{</b><font color="green">"&"</font> equalityExpr<b>}</b> <b>.</b>
<b>equalityExpr</b> <b>=</b> relationalExpr <b>{</b>equalityOp relationalExpr<b>}</b> <b>.</b>
<b>relationalExpr</b> <b>=</b> intervalExpr <b>{</b>relOp intervalExpr <b>|</b> <font color="green">"typeis"</font> typeLiteralType<b>}</b> <b>.</b>
<b>intervalExpr</b> <b>=</b> bitshiftExpr <b>[</b>intervalOp bitshiftExpr<b>]</b> <b>.</b>
<b>bitshiftExpr</b> <b>=</b> additiveExpr <b>{</b>bitshiftOp additiveExpr<b>}</b> <b>.</b>
<b>additiveExpr</b> <b>=</b> multiplicativeExpr <b>{</b>additiveOp multiplicativeExpr<b>}</b> <b>.</b>
<b>multiplicativeExpr</b> <b>=</b> typeAsExpr <b>{</b>multiplicativeOp typeAsExpr<b>}</b> <b>.</b>
<b>typeAsExpr</b> <b>=</b> unaryExpr <b>{</b>typeAsOp typeLiteral<b>}</b> <b>.</b>
<b>unaryExpr</b> <b>=</b> <b>(</b><font color="green">"+"</font> <b>|</b> <font color="green">"-"</font><b>)</b> unaryExprNotPlusMinus <b>|</b> unaryExprNotPlusMinus <b>.</b>
<b>unaryExprNotPlusMinus</b> <b>=</b> unaryOp unaryExpr <b>|</b> <font color="green">"\"</font> blockExpr <b>|</b> evalExpr <b>|</b> primaryExpr <b>.</b>
<b>blockExpr</b> <b>=</b> <b>[</b>parameterDeclarationList<b>]</b> <font color="green">"->"</font> <b>(</b>expression <b>|</b> statementBlock<b>)</b> <b>.</b>
<b>parameterDeclarationList</b> <b>=</b> parameterDeclaration <b>{</b><font color="green">","</font> parameterDeclaration<b>}</b> <b>.</b>
<b>parameterDeclaration</b> <b>=</b> <b>{</b>annotation<b>}</b> <b>[</b><font color="green">"final"</font><b>]</b> id <b>[</b><b>(</b><font color="green">":"</font> typeLiteral <b>[</b><font color="green">"="</font> expression<b>]</b><b>)</b> <b>|</b> blockTypeLiteral <b>|</b> <font color="green">"="</font> expression<b>]</b> <b>.</b>
<b>annotationArguments</b> <b>=</b> arguments <b>.</b>
<b>arguments</b> <b>=</b> <font color="green">"("</font> <b>[</b>argExpression <b>{</b><font color="green">","</font> argExpression<b>}</b><b>]</b> <font color="green">")"</font> <b>.</b>
<b>optionalArguments</b> <b>=</b> <b>[</b>arguments<b>]</b> <b>.</b>
<b>argExpression</b> <b>=</b> namedArgumentExpression <b>|</b> expression <b>.</b>
<b>namedArgumentExpression</b> <b>=</b> <font color="green">":"</font> id <font color="green">"="</font> expression <b>.</b>
<b>evalExpr</b> <b>=</b> <font color="green">"eval"</font> <font color="green">"("</font> expression <font color="green">")"</font> <b>.</b>
<b>featureLiteral</b> <b>=</b> <font color="green">"#"</font> <b>(</b>id <b>|</b> <font color="green">"construct"</font><b>)</b> typeArguments optionalArguments <b>.</b>
<b>standAloneDataStructureInitialization</b> <b>=</b> <font color="green">"{"</font> <b>[</b>initializerExpression<b>]</b> <font color="green">"}"</font> <b>.</b>
<b>primaryExpr</b> <b>=</b> <b>(</b>newExpr <b>|</b> thisSuperExpr <b>|</b> literal <b>|</b> typeLiteralExpr <b>|</b> parenthExpr <b>|</b> standAloneDataStructureInitialization<b>)</b> indirectMemberAccess <b>.</b>
<b>parenthExpr</b> <b>=</b> <font color="green">"("</font> expression <font color="green">")"</font> <b>.</b>
<b>newExpr</b> <b>=</b> <font color="green">"new"</font> <b>[</b>classOrInterfaceType<b>]</b> <b>(</b><b>(</b>arguments <b>[</b><font color="green">"{"</font> <b>(</b>initializer <b>|</b> anonymousInnerClass<b>)</b> <font color="green">"}"</font><b>]</b><b>)</b> <b>|</b> <b>(</b><font color="green">"["</font> <b>(</b><font color="green">"]"</font> <b>{</b><font color="green">"["</font> <font color="green">"]"</font><b>}</b> arrayInitializer <b>|</b> expression <font color="green">"]"</font> <b>{</b><font color="green">"["</font> expression <font color="green">"]"</font><b>}</b> <b>{</b><font color="green">"["</font> <font color="green">"]"</font><b>}</b><b>)</b><b>)</b><b>)</b> <b>.</b>
<b>anonymousInnerClass</b> <b>=</b> classMembers <b>.</b>
<b>arrayInitializer</b> <b>=</b> <font color="green">"{"</font> <b>[</b>expression <b>{</b><font color="green">","</font> expression<b>}</b><b>]</b> <font color="green">"}"</font> <b>.</b>
<b>initializer</b> <b>=</b> <b>[</b>initializerExpression <b>|</b> objectInitializer<b>]</b> <b>.</b>
<b>initializerExpression</b> <b>=</b> mapInitializerList <b>|</b> arrayValueList <b>.</b>
<b>arrayValueList</b> <b>=</b> expression <b>{</b><font color="green">","</font> expression<b>}</b> <b>.</b>
<b>mapInitializerList</b> <b>=</b> expression <font color="green">"->"</font> expression <b>{</b><font color="green">","</font> expression <font color="green">"->"</font> expression<b>}</b> <b>.</b>
<b>objectInitializer</b> <b>=</b> initializerAssignment <b>{</b><font color="green">","</font> initializerAssignment<b>}</b> <b>.</b>
<b>initializerAssignment</b> <b>=</b> <font color="green">":"</font> id <font color="green">"="</font> expression <b>.</b>
<b>indirectMemberAccess</b> <b>=</b> <b>{</b><b>(</b><font color="green">"."</font> <b>|</b> <font color="green">"?."</font> <b>|</b> <font color="green">"*."</font><b>)</b> idAll typeArguments <b>|</b> featureLiteral <b>|</b> <b>(</b><font color="green">"["</font> <b>|</b> <font color="green">"?["</font><b>)</b> expression <font color="green">"]"</font> <b>|</b> arguments<b>}</b> <b>.</b>
<b>literal</b> <b>=</b> NumberLiteral <b>|</b> featureLiteral <b>|</b> StringLiteral <b>|</b> CharLiteral <b>|</b> <font color="green">"true"</font> <b>|</b> <font color="green">"false"</font> <b>|</b> <font color="green">"null"</font> <b>.</b>
<b>orOp</b> <b>=</b> <font color="green">"||"</font> <b>|</b> <font color="green">"or"</font> <b>.</b>
<b>andOp</b> <b>=</b> <font color="green">"&&"</font> <b>|</b> <font color="green">"and"</font> <b>.</b>
<b>assignmentOp</b> <b>=</b> <font color="green">"="</font> <b>|</b> <font color="green">"+="</font> <b>|</b> <font color="green">"-="</font> <b>|</b> <font color="green">"*="</font> <b>|</b> <font color="green">"/="</font> <b>|</b> <font color="green">"&="</font> <b>|</b> <font color="green">"|="</font> <b>|</b> <font color="green">"^="</font> <b>|</b> <font color="green">"%="</font> <b>|</b> <font color="green">"<"</font> <font color="green">"<"</font> <font color="green">"="</font> <b>|</b> <font color="green">">"</font> <font color="green">">"</font> <font color="green">">"</font> <font color="green">"="</font> <b>|</b> <font color="green">">"</font> <font color="green">">"</font> <font color="green">"="</font> <b>.</b>
<b>incrementOp</b> <b>=</b> <font color="green">"++"</font> <b>|</b> <font color="green">"--"</font> <b>.</b>
<b>equalityOp</b> <b>=</b> <font color="green">"==="</font> <b>|</b> <font color="green">"!=="</font> <b>|</b> <font color="green">"=="</font> <b>|</b> <font color="green">"!="</font> <b>|</b> <font color="green">"<>"</font> <b>.</b>
<b>intervalOp</b> <b>=</b> <font color="green">".."</font> <b>|</b> <font color="green">"|.."</font> <b>|</b> <font color="green">"..|"</font> <b>|</b> <font color="green">"|..|"</font> <b>.</b>
<b>relOp</b> <b>=</b> <font color="green">"<"</font> <font color="green">"="</font> <b>|</b> <font color="green">">"</font> <font color="green">"="</font> <b>|</b> <font color="green">"<"</font> <b>|</b> <font color="green">">"</font> <b>.</b>
<b>bitshiftOp</b> <b>=</b> <font color="green">"<"</font> <font color="green">"<"</font> <b>|</b> <font color="green">">"</font> <font color="green">">"</font> <font color="green">">"</font> <b>|</b> <font color="green">">"</font> <font color="green">">"</font> <b>.</b>
<b>additiveOp</b> <b>=</b> <font color="green">"+"</font> <b>|</b> <font color="green">"-"</font> <b>|</b> <font color="green">"?+"</font> <b>|</b> <font color="green">"?-"</font> <b>.</b>
<b>multiplicativeOp</b> <b>=</b> <font color="green">"*"</font> <b>|</b> <font color="green">"/"</font> <b>|</b> <font color="green">"%"</font> <b>|</b> <font color="green">"?*"</font> <b>|</b> <font color="green">"?/"</font> <b>|</b> <font color="green">"?%"</font> <b>.</b>
<b>typeAsOp</b> <b>=</b> <font color="green">"typeas"</font> <b>|</b> <font color="green">"as"</font> <b>.</b>
<b>unaryOp</b> <b>=</b> <font color="green">"~"</font> <b>|</b> <font color="green">"!"</font> <b>|</b> <font color="green">"not"</font> <b>|</b> <font color="green">"typeof"</font> <b>|</b> <font color="green">"statictypeof"</font> <b>.</b>
<b>id</b> <b>=</b> Ident <b>.</b>
<b>idclassOrInterfaceType</b> <b>=</b> Ident <b>.</b>
<b>idAll</b> <b>=</b> Ident <b>.</b>
<b>Ident</b> <b>=</b> Letter <b>{</b>Digit <b>|</b> Letter<b>}</b> <b>.</b>
<b>NumberLiteral</b> <b>=</b> <font color="green">"NaN"</font> <b>|</b> <font color="green">"Infinity"</font> <b>|</b> HexLiteral <b>|</b> BinLiteral <b>|</b> IntOrFloatPointLiteral <b>.</b>
<b>BinLiteral</b> <b>=</b> <b>(</b><font color="green">"0b"</font> <b>|</b> <font color="green">"0B"</font><b>)</b> <font color="green">"0"</font> <b>|</b> <font color="green">"1"</font> <b>{</b><font color="green">"0"</font> <b>|</b> <font color="green">"1"</font><b>}</b> <b>[</b>IntegerTypeSuffix<b>]</b> <b>.</b>
<b>HexLiteral</b> <b>=</b> <b>(</b><font color="green">"0x"</font> <b>|</b> <font color="green">"0X"</font><b>)</b> HexDigit <b>{</b>HexDigit<b>}</b> <b>[</b><font color="green">"s"</font> <b>|</b> <font color="green">"S"</font> <b>|</b> <font color="green">"l"</font> <b>|</b> <font color="green">"L"</font><b>]</b> <b>.</b>
<b>IntOrFloatPointLiteral</b> <b>=</b> <font color="green">"."</font> Digit <b>{</b>Digit<b>}</b> <b>[</b>FloatTypeSuffix<b>]</b> <b>|</b> Digit <b>{</b>Digit<b>}</b> <b>(</b><font color="green">"."</font> <b>{</b>Digit<b>}</b> <b>[</b>Exponent<b>]</b> <b>[</b>FloatTypeSuffix<b>]</b> <b>|</b> Exponent <b>[</b>FloatTypeSuffix<b>]</b> <b>|</b> FloatTypeSuffix <b>|</b> IntegerTypeSuffix <b>|</b><b>)</b> <b>.</b>
<b>CharLiteral</b> <b>=</b> <font color="green">"'"</font> <b>(</b>EscapeSequence <b>|</b> any_character<b>)</b> <font color="green">"'"</font> <b>.</b>
<b>StringLiteral</b> <b>=</b> <font color="green">"'"</font> <b>{</b>EscapeSequence <b>|</b> any_character<b>}</b> <font color="green">"'"</font> <b>|</b> <font color="green">"""</font> <b>{</b>EscapeSequence <b>|</b> any_character<b>}</b> <font color="green">"""</font> <b>.</b>
<b>HexDigit</b> <b>=</b> Digit <b>|</b> <font color="green">"a"</font>..<font color="green">"f"</font> <b>|</b> <font color="green">"A"</font>..<font color="green">"F"</font> <b>.</b>
<b>IntegerTypeSuffix</b> <b>=</b> <b>(</b><font color="green">"l"</font> <b>|</b> <font color="green">"L"</font> <b>|</b> <font color="green">"s"</font> <b>|</b> <font color="green">"S"</font> <b>|</b> <font color="green">"bi"</font> <b>|</b> <font color="green">"BI"</font> <b>|</b> <font color="green">"b"</font> <b>|</b> <font color="green">"B"</font><b>)</b> <b>.</b>
<b>Letter</b> <b>=</b> <font color="green">"A"</font>..<font color="green">"Z"</font> <b>|</b> <font color="green">"a"</font>..<font color="green">"z"</font> <b>|</b> <font color="green">"_"</font> <b>|</b> <font color="green">"$"</font> <b>.</b>
<b>Digit</b> <b>=</b> <font color="green">"0"</font> <b>|</b> <font color="green">"1"</font> <b>|</b> <font color="green">"2"</font> <b>|</b> <font color="green">"3"</font> <b>|</b> <font color="green">"4"</font> <b>|</b> <font color="green">"5"</font> <b>|</b> <font color="green">"6"</font> <b>|</b> <font color="green">"7"</font> <b>|</b> <font color="green">"8"</font> <b>|</b> <font color="green">"9"</font> <b>.</b>
<b>NonZeroDigit</b> <b>=</b> <font color="green">"1"</font> <b>|</b> <font color="green">"2"</font> <b>|</b> <font color="green">"3"</font> <b>|</b> <font color="green">"4"</font> <b>|</b> <font color="green">"5"</font> <b>|</b> <font color="green">"6"</font> <b>|</b> <font color="green">"7"</font> <b>|</b> <font color="green">"8"</font> <b>|</b> <font color="green">"9"</font> <b>.</b>
<b>ZeroToSeven</b> <b>=</b> <font color="green">"0"</font> <b>|</b> <font color="green">"1"</font> <b>|</b> <font color="green">"2"</font> <b>|</b> <font color="green">"3"</font> <b>|</b> <font color="green">"4"</font> <b>|</b> <font color="green">"5"</font> <b>|</b> <font color="green">"6"</font> <b>|</b> <font color="green">"7"</font> <b>.</b>
<b>Exponent</b> <b>=</b> <b>(</b><font color="green">"e"</font> <b>|</b> <font color="green">"E"</font><b>)</b> <b>[</b><font color="green">"+"</font> <b>|</b> <font color="green">"-"</font><b>]</b> Digit <b>{</b>Digit<b>}</b> <b>.</b>
<b>FloatTypeSuffix</b> <b>=</b> <b>(</b><font color="green">"f"</font> <b>|</b> <font color="green">"F"</font> <b>|</b> <font color="green">"d"</font> <b>|</b> <font color="green">"D"</font> <b>|</b> <font color="green">"bd"</font> <b>|</b> <font color="green">"BD"</font><b>)</b> <b>.</b>
<b>EscapeSequence</b> <b>=</b> <font color="green">"\"</font> <b>(</b><font color="green">"v"</font> <b>|</b> <font color="green">"a"</font> <b>|</b> <font color="green">"b"</font> <b>|</b> <font color="green">"t"</font> <b>|</b> <font color="green">"n"</font> <b>|</b> <font color="green">"f"</font> <b>|</b> <font color="green">"r"</font> <b>|</b> <font color="green">"""</font> <b>|</b> <font color="green">"'"</font> <b>|</b> <font color="green">"\"</font> <b>|</b> <font color="green">"$"</font> <b>|</b> <font color="green">"<"</font><b>)</b> <b>|</b> UnicodeEscape <b>|</b> OctalEscape <b>.</b>
<b>OctalEscape</b> <b>=</b> <font color="green">"\"</font> <b>(</b><font color="green">"0"</font> <b>|</b> <font color="green">"1"</font> <b>|</b> <font color="green">"2"</font> <b>|</b> <font color="green">"3"</font><b>)</b> ZeroToSeven ZeroToSeven</b> <b>|</b> <font color="green">"\"</font> ZeroToSeven ZeroToSeven <b>|</b> <font color="green">"\"</font> ZeroToSeven <b>.</b>
<b>UnicodeEscape</b> <b>=</b> <font color="green">"\"</font> <font color="green">"u"</font> HexDigit HexDigit HexDigit HexDigit <b>.</b>
<b>WS</b> <b>=</b> white_space <b>.</b>
<b>COMMENT</b> <b>=</b> <font color="green">"/*"</font> <b>{</b>any_character<b>}</b> <font color="green">"*/"</font> <b>.</b>
<b>LINE_COMMENT</b> <b>=</b> <font color="green">"//"</font> <b>{</b>any_character<b>}</b> <b>.</b>
</pre>