Skip to content

Commit 03abb37

Browse files
committed
Grammar Backus-Naur Form definition for test and use statement.
1 parent 4d03525 commit 03abb37

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

grammar.bnf

+11
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,23 @@ DIGIT :=
1313
global := (statement)*
1414

1515
statement :=
16+
use_stmt |
17+
test_stmt |
1618
break_stmt |
1719
continue_stmt |
1820
ret_stmt |
1921
throw_stmt |
2022
expr_stmt
2123

24+
use_stmt :=
25+
"use" expression
26+
[expression ("," expression)*]
27+
";"
28+
29+
test_stmt :=
30+
"test" "(" expression ")"
31+
expression ";"
32+
2233
break_stmt := "break" ";"
2334
continue_stmt := "continue" ";"
2435
ret_stmt := "ret" expression ";"

site/grammar.pug

+14-3
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,23 @@ html(lang="en")
123123
| global := (statement)*
124124
|
125125
| statement :=
126+
| use_stmt |
127+
| test_stmt |
126128
| break_stmt |
127-
| continue_stmt |
128-
| ret_stmt |
129-
| throw_stmt |
129+
| continue_stmt |
130+
| ret_stmt |
131+
| throw_stmt |
130132
| expr_stmt
131133
|
134+
| use_stmt :=
135+
| "use" expression
136+
| [expression ("," expression)*]
137+
| ";"
138+
|
139+
| test_stmt :=
140+
| "test" "(" expression ")"
141+
| expression ";"
142+
|
132143
| break_stmt := "break" ";"
133144
| continue_stmt := "continue" ";"
134145
| ret_stmt := "ret" expression ";"

0 commit comments

Comments
 (0)