-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrammar.txt
More file actions
29 lines (28 loc) · 1.12 KB
/
Copy pathgrammar.txt
File metadata and controls
29 lines (28 loc) · 1.12 KB
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
TODO: function : function IDENTIFIER L_PAREN variable?, ... R_PAREN T_COLLON statements endfunction
append : append T_L_PAREN collection T_COMMA expr T_R_PAREN
count : count T_L_PAREN collection T_R_PAREN
print : print string
print : print expr
loop : loop variable SEMICOLON cond SEMICOLON expr COLON body ENDLOOP
: loop variable SEMICOLON expr COLON body ENDLOOP
: loop expr COLON body ENDLOOP
while : while cond body endwhile
if : if cond COLON body ENDIF
body : statements
statement : variable|if|expr
variable : declare IDENTIFIER EQ expr
: IDENTIFIER EQ expr
: declare IDENTIFIER
collection : l_bracket object T_COMMA object T_COMMA ... r_bracket
cond : expr
expr : declare IDENTIFIER EQ expr
: comp-expr (and|or) comp-expr
comp-expr : arith-expr (and|or) arith-expr
arith-expr : expr (>|<|>=|<=|==) expr
: term (PLUS|MINUS) term
term : factor (MUL|DIV) factor
factor : INT|FLOAT
power : factor ^ factor
l_bracket : [
r_bracket : ]
object : any data structure