-
Notifications
You must be signed in to change notification settings - Fork 0
/
5.1.b_sum_of_1-10
37 lines (33 loc) · 5.02 KB
/
5.1.b_sum_of_1-10
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
program {
main() -> void{
int i=0;
int sum=0;
while(i<=9){
i = i+1;
sum = sum+i;
}
print(sum);
}
}
program -1-> PROGRAM LBRACKET program_body RBRACKET
-2-> PROGRAM LBRACKET main_function RBRACKET
-3-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID block RBRACKET
-9-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET ( statement )* RBRACKET RBRACKET
-10-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET simple_statement SEMICOLON simple_statement SEMICOLON compound_statement simple_statement SEMICOLON RBRACKET RBRACKET
-11-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET variable_definition SEMICOLON variable_definition SEMICOLON compound_statement print_statement SEMICOLON RBRACKET RBRACKET
-13-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET type assignment SEMICOLON type assignment SEMICOLON compound_statement print_statement SEMICOLON RBRACKET RBRACKET
-6-7-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT assignment SEMICOLON INT assignment SEMICOLON compound_statement print_statement SEMICOLON RBRACKET RBRACKET
-14-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT variable BECOMES assignable SEMICOLON INT variable BECOMES assignable SEMICOLON compound_statement print_statement SEMICOLON RBRACKET RBRACKET
-35-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES assignable SEMICOLON INT IDENTIFIER BECOMES assignable SEMICOLON compound_statement print_statement SEMICOLON RBRACKET RBRACKET
-22-26-27-28-29-30-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON compound_statement print_statement SEMICOLON RBRACKET RBRACKET
-17-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON compound_statement PRINT LPAREN assignable RPAREN SEMICOLON RBRACKET RBRACKET
-22-26-27-28-29-30-35-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON compound_statement PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
-12-20-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON WHILE LPAREN expression RPAREN block PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
-9-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON WHILE LPAREN expression RPAREN LBRACKET statement statement RBRACKET PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
-10-11-14-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON WHILE LPAREN expression RPAREN LBRACKET variable BECOMES assignable SEMICOLON variable BECOMES assignable SEMICOLON RBRACKET PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
-35-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON WHILE LPAREN expression RPAREN LBRACKET IDENTIFIER BECOMES assignable SEMICOLON IDENTIFIER BECOMES assignable SEMICOLON RBRACKET PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
-22-26-27-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON WHILE LPAREN expression RPAREN LBRACKET IDENTIFIER BECOMES signed_term additive_operator signed_term SEMICOLON IDENTIFIER BECOMES signed_term additive_operator signed_term SEMICOLON RBRACKET PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
-28-29-30-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON WHILE LPAREN expression RPAREN LBRACKET IDENTIFIER BECOMES signed_term additive_operator INT_LITERAL SEMICOLON IDENTIFIER BECOMES signed_term additive_operator variable SEMICOLON RBRACKET PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
-35-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON WHILE LPAREN expression RPAREN LBRACKET IDENTIFIER BECOMES signed_term additive_operator INT_LITERAL SEMICOLON IDENTIFIER BECOMES signed_term additive_operator IDENTIFIER SEMICOLON RBRACKET PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
-35-> PROGRAM LBRACKET 'main' LPAREN RPAREN ARROW VOID LBRACKET INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON INT IDENTIFIER BECOMES INT_LITERAL SEMICOLON WHILE LPAREN expression RPAREN LBRACKET IDENTIFIER BECOMES signed_term additive_operator INT_LITERAL SEMICOLON IDENTIFIER BECOMES signed_term additive_operator IDENTIFIER SEMICOLON RBRACKET PRINT LPAREN IDENTIFIER RPAREN SEMICOLON RBRACKET RBRACKET
//And so on....