-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrammar
More file actions
33 lines (25 loc) · 875 Bytes
/
grammar
File metadata and controls
33 lines (25 loc) · 875 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
26
27
28
29
30
31
32
33
Grammar -> MainFuncDecl
MainFuncDecl -> main FuncBody
FuncBody -> { VarDecl StatementList ReturnStatement }
VarDecl -> Type identifier ; VarDecl
VarDecl ->
ReturnStatement -> return Expr ;
StatementList -> Statement StatementList
StatementList ->
Statement -> if ( Expr ) then Statement else Statement fi
Statement -> repeat Statement until ( Expr ) ;
Statement -> print ( Expr ) ;
Statement -> { StatementList }
Statement -> IdAccess := Expr ; // Meaning: assignment
Expr -> BaseExpr op BaseExpr
Expr -> ! BaseExpr
Expr -> BaseExpr
BaseExpr -> ( Expr )
BaseExpr -> IdAccess
BaseExpr -> integer
BaseExpr -> true
BaseExpr -> false
BaseExpr -> read ( )
IdAccess -> identifier
Type -> int
Type -> boolean