-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLL-grammar
More file actions
executable file
·45 lines (45 loc) · 1.53 KB
/
LL-grammar
File metadata and controls
executable file
·45 lines (45 loc) · 1.53 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
prog_body -> EOF
EOL <prog_body>
Scope EOL <main_body> <prog_body>
Declare Function fncName ( <par_list> As <var_type> EOL <prog_body>
Function id ( <par_list> As <var_type> EOL <fnc_body> EOL <prog_body>
main_body -> <command><main_body>
End Scope
fnc_body -> <command><fnc_body>
End Function
if_body -> <command><if_body>
ElseIf EXP Then EOL <if_body>
Else <else_body>
End If
else_body -> <command><else_body>
End If
while_body -> <command><while_body>
Loop
par_list -> )
id As <var_type> <par_next>
par_next -> , id As <var type> <par_next>
)
arg_list -> )
id <arg_next>
const <arg_next>
arg_next -> )
, <arg_next2>
arg_next2 -> id <arg_next>
const <arg_next>
var_type -> Integer
Double
String
print_exp -> EXP; <print_exp>
EOL
command -> Input id EOL
If EXP Then EOL <if_body> EOL
id = <assignment> EOL
Do While EXP EOL <while_body> EOL
Print EXP ; <print_exp>
Dim id As <var_type> <dim_end>
Return EXP EOL
EOL
dim_end -> EOL
= <assignment> EOL
assignment -> EXP
id ( <arg_list>