-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgrammar.txt
More file actions
25 lines (22 loc) · 752 Bytes
/
grammar.txt
File metadata and controls
25 lines (22 loc) · 752 Bytes
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
primExpr->Number|String|Identifier|(addExpr);
mulExpr->primExpr (mulOperator primExpr)*
mulOperator-> "*"|"/"|"%""
addExpr->mulExpr (addOperator mulExpr)*
addOperator->"+"|"-""
cmpOp->'=='|'!='|'>'|'<'|'>='|'<='
cmpExpr->addExpr (cmpOp addExpr)
boolOp->'&&' | '||'
boolExpr->cmpExpr (boolOp cmpExpr)*
notExpr->'!'* boolExpr
primExpr->number|string|'('expr')'
expr->notExpr
stmt->outStmt
stat->stmt*
OutStmt->"out" addExpr ";"
VorcStmt->("var"|"const)" "<"type">"iden "=" (value | value_expr) ";"
AssignStmt->iden "=" (value | value_expr) ";"
DeleteStmt->"delete" iden ";"
InputStmt->"input" "(" content ")" "=>" identifier ";"
WhileStmt->"while" boolExpr | notBoolExpr ":" block
IfStmt->"if" boolExpr | notBoolExpr ":" block
BlockStmt->"{" stmts "}"