-
Notifications
You must be signed in to change notification settings - Fork 5
/
syn_grammar.txt
71 lines (71 loc) · 2.53 KB
/
syn_grammar.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
start1:start
start:external_declaration start
start:$
primary_expression:identifier
primary_expression:number
primary_expression:( expression )
operator:+
operator:-
operator:*
operator:/
operator:%
operator:<
operator:>
arithmetic_expression:operator
arithmetic_expression:primary_expression arithmetic_expression
arithmetic_expression:operator primary_expression arithmetic_expression
arithmetic_expression:$
constant_expression:primary_expression arithmetic_expression
assignment_operator:=
assignment_operator:+ =
assignment_operator:- =
assignment_operator:* =
assignment_operator:/ =
assignment_operator:% =
assignment_expression:identifier assignment_operator expression
assignment_expression_profix:, assignment_expression assignment_expression_profix
assignment_expression_profix:$
assignment_expression_list:assignment_expression assignment_expression_profix
assignment_expression_list:$
function_expression:function identifier ( expression_list )
expression:constant_expression
expression:function_expression
expression_profix:, expression expression_profix
expression_profix:$
expression_list:expression expression_profix
expression_list:$
type_specifier:char
type_specifier:int
type_specifier:double
declaration_assign:= expression
declaration_assign:$
declaration_init:identifier declaration_assign
declaration_init_list:, declaration_init declaration_init_list
declaration_init_list:$
declaration:type_specifier declaration_init declaration_init_list ;
function_declaration:type_specifier identifier
function_declaration_suffix:, function_declaration function_declaration_suffix
function_declaration_suffix:$
function_declaration_list:function_declaration function_declaration_suffix
function_declaration_list:$
function_definition:function type_specifier identifier ( function_declaration_list ) compound_statement
statement:expression_statement
statement:jump_statement
statement:selection_statement
statement:iteration_statement
statement:compound_statement
statement:declaration
statement_list:statement statement_list
statement_list:$
expression_statement:assignment_expression_list ;
expression_statement:print ( expression ) ;
expression_statement:scanf ( identifier ) ;
jump_statement:continue ;
jump_statement:break ;
jump_statement:return expression ;
selection_statement:if ( expression ) statement else statement
iteration_statement:while ( expression ) statement
iteration_statement:for ( declaration expression ; assignment_expression ) statement
compound_statement:{ statement_list }
external_declaration:function_definition
external_declaration:declaration