Compiler/Sample programs: Difference between revisions
Fix bug in C solution
(Additional samples) |
(Fix bug in C solution) |
||
Line 1,696:
/* 99 bottles */
bottles = 99;
while (bottles >
print(bottles, " bottles of beer on the wall\n");
print(bottles, " bottles of beer\n");
print("Take one down, pass it around\n");
print(bottles, " bottles of beer on the wall\n\n");▼
bottles = bottles - 1;
▲ print(bottles, " bottles of beer on the wall\n\n");
}
</lang>
Line 1,715:
3 7 LeftParen
3 8 Identifier bottles
3 16
3
3
3
4 5 Keyword_print
4 10 LeftParen
Line 1,738:
6 44 RightParen
6 45 Semicolon
7 5
7
7
7
7
7
8 10
8
8
8
8
9 1 RightBrace
10 1 End_of_input
Line 1,797:
String "Take one down, pass it around\n"
;
Assign▼
Identifier bottles▼
Subtract▼
Identifier bottles▼
Integer 1▼
Sequence
Sequence
Line 1,806 ⟶ 1,811:
String " bottles of beer on the wall\n\n"
;
▲Assign
▲Identifier bottles
▲Subtract
▲Identifier bottles
▲Integer 1
</pre></b>
Line 1,838:
55 prts
56 fetch [0]
61
67
78
84 jmp (-75) 10
89 halt
Line 1,857:
99 bottles of beer
Take one down, pass it around
98 bottles of beer on the wall
98 bottles of beer
▲98 bottles of beer on the wall
Take one down, pass it around
97 bottles of beer on the wall
Line 1,874 ⟶ 1,869:
2 bottles of beer
Take one down, pass it around
1 bottles of beer on the wall
1 bottles of beer
Take one down, pass it around
</pre>
|