-
Notifications
You must be signed in to change notification settings - Fork 2
/
CFG.txt
50 lines (50 loc) · 1.34 KB
/
CFG.txt
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Prolog ::= package id EOL EOL_opt Prog
Prog ::= func Func EOL EOL_opt Prog
Prog ::= eof
Func ::= id ( Params ) Ret_type { EOL_opt Statement_list }
EOL_opt ::= EOL EOL_opt
EOL_opt ::= ''
Params ::= id Type Params_n
Params ::= ''
Params_n ::= , id Type Params_n
Params_n ::= ''
Ret_type ::= ''
Ret_type ::= ( Type Ret_type_n )
Ret_type_n ::= , Type Ret_type_n
Ret_type_n ::= ''
Statement_list ::= Statement EOL EOL_opt Statement_list
Statement_list ::= ''
Statement ::= id Var
Var ::= := exp
Var ::= Func_call
Var ::= Assign = EOL_opt End_assign
Assign ::= , EOL_opt id Assign
Assign ::= ''
End_assign ::= id Func_call
End_assign ::= exp Exp_n
Exp_n ::= , EOL_opt exp Exp_n
Exp_n ::= ''
Statement ::= if EOL_opt exp { EOL EOL_opt Statement_list } else { EOL EOL_opt Statement_list }
Statement ::= for EOL_opt For_def ; EOL_opt exp ; EOL_opt For_assign { EOL EOL_opt Statement_list }
For_def ::= ''
For_def ::= id Var
For_assign ::= ''
For_assign ::= id Assign = End_assign
Func_call ::= ( Call_params )
Call_params ::= Term Term_n
Call_params ::= ''
Type ::= int
Type ::= float
Type ::= bool
Type ::= string
Term ::= id
Term ::= celecislo
Term ::= desatinnecislo
Term ::= retazec
Term ::= true
Term ::= false
Term_n ::= , Term Term_n
Term_n ::= ''
Statement ::= return Return_exp
Return_exp ::= ''
Return_exp ::= exp Exp_n