Statement Grammar
statement
→
labeled‑statement
|
control‑statement
|
expression‑statement
|
assignment‑statement
|
construction‑statement
|
delete‑statement
|
destroy‑statement
|
empty‑statement
|
throw‑statement
|
try‑statement
|
assert‑statement
|
conditional‑compilation‑statement
label
→
id
:
labeled‑statement
→
label
statement
control‑statement
→
compound‑statement
|
return‑statement
|
if‑statement
|
while‑statement
|
do‑statement
|
range‑for‑statement
|
for‑statement
|
break‑statement
|
continue‑statement
|
goto‑statement
|
switch‑statement
|
goto‑case‑statement
|
goto‑default‑statement
compound‑statement
→
{
statement
*
}
return‑statement
→
return
expression
?
;
if‑statement
→
if
(
expression
)
statement
(
else
statement
)
?
while‑statement
→
while
(
expression
)
statement
do‑statement
→
do
statement
while
(
expression
)
;
for‑statement
→
for
(
for‑init‑statement
expression
?
;
for‑loop‑statement‑expr
)
statement
for‑init‑statement
→
assignment‑statement
|
construction‑statement
|
empty‑statement
for‑loop‑statement‑expr
→
assignment‑statement‑expr
|
expression
|
<empty>
range‑for‑statement
→
for
(
type‑expr
identifier
:
expression
)
statement
break‑statement
→
break
;
continue‑statement
→
continue
;
goto‑statement
→
goto
id
;
switch‑statement
→
switch
(
expression
)
{
(
case‑statement
|
default‑statement
)
*
}
case‑statement
→
(
case
expression
:
)
+
statement
*
default‑statement
→
default
:
statement
*
goto‑case‑statement
→
goto
case
expression
;
goto‑default‑statement
→
goto
default
;
assignment‑statement‑expr
→
expression
=
expression
assignment‑statement
→
assignment‑statement‑expr
;
construction‑statement
→
type‑expr
identifier
(
=
expression
|
(
argument‑list
)
|
<empty>
)
;
delete‑statement
→
delete
expression
;
destroy‑statement
→
destroy
expression
;
expression‑statement
→
expression
;
empty‑statement
→
;
throw‑statement
→
throw
expression
?
;
try‑statement
→
try
compound‑statement
catch
+
catch
→
catch
(
type‑expr
identifier
?
)
compound‑statement
assert‑statement
→
#
assert
expression
;
conditional‑compilation‑statement
→
#
if
(
conditional‑compilation‑expression
)
statement
*
(
#
elif
(
conditional‑compilation‑expression
)
statement
*
)
*
(
#
else
statement
*
)
?
#
endif
conditional‑compilation‑expression
→
conditional‑compilation‑disjunction
conditional‑compilation‑disjunction
→
conditional‑compilation‑conjunction
(
|
|
conditional‑compilation‑conjunction
)
*
conditional‑compilation‑conjunction
→
conditional‑compilation‑prefix
(
&
&
conditional‑compilation‑prefix
)
*
conditional‑compilation‑prefix
→
!
conditional‑compilation‑prefix
|
conditional‑compilation‑primary
conditional‑compilation‑primary
→
id
|
(
conditional‑compilation‑expression
)