-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrammar.txt
More file actions
executable file
·96 lines (96 loc) · 2.16 KB
/
grammar.txt
File metadata and controls
executable file
·96 lines (96 loc) · 2.16 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
S -> func funcs
funcs -> func funcs
funcs -> $
func -> type IDN ( args ) func_body
type -> int
type -> short
type -> long
type -> char
type -> float
type -> double
type -> void
type -> unsigned type
args -> type IDN arg
args -> $
arg -> , type IDN arg
arg -> $
func_body -> ;
func_body -> block
block -> { define_stmts stmts }
define_stmts -> define_stmt define_stmts
define_stmts -> $
define_stmt -> type IDN init vars ;
init -> = expression
init -> $
vars -> , IDN init vars
vars -> $
stmts -> stmt stmts
stmts -> $
stmt -> assign_stmt
stmt -> jump_stmt
stmt -> iteration_stmt
stmt -> branch_stmt
assign_stmt -> expression ;
jump_stmt -> continue ;
jump_stmt -> break ;
jump_stmt -> return isnull_expr ;
iteration_stmt -> while ( logical_expression ) block_stmt
iteration_stmt -> for ( isnull_expr ; isnull_expr ; isnull_expr ) block_stmt
iteration_stmt -> do block_stmt while ( logical_expression ) ;
branch_stmt -> if ( logical_expression ) block_stmt result
result -> else block_stmt
result -> $
logical_expression -> ! expression bool_expression
logical_expression -> expression bool_expression
bool_expression -> lop expression bool_expression
bool_expression -> $
lop -> &&
lop -> ||
branch_stmt -> switch ( IDN ) { case_stmt case_stmts default_stmt }
case_stmts -> case_stmt case_stmts
case_stmts -> $
case_stmt -> case const : stmts
default_stmt -> default : stmts
block_stmt -> { stmts }
isnull_expr -> expression
isnull_expr -> $
expression -> value operation
operation -> compare_op value
operation -> equal_op value
operation -> $
compare_op -> >
compare_op -> >=
compare_op -> <
compare_op -> <=
compare_op -> ==
compare_op -> !=
equal_op -> =
equal_op -> +=
equal_op -> -=
equal_op -> *=
equal_op -> /=
equal_op -> %=
value -> item value'
value' -> + item value'
value' -> - item value'
value' -> $
item -> factor item'
item' -> * factor item'
item' -> / factor item'
item' -> % factor item'
item' -> $
factor -> ( value )
factor -> IDN call_func
factor -> const
call_func -> ( es )
call_func -> $
es -> isnull_expr isnull_es
isnull_es -> , isnull_expr isnull_es
isnull_es -> $
const -> num_const
const -> FLOAT
const -> CHAR
const -> STR
num_const -> INT10
num_const -> INT8
num_const -> INT16