Skip to content

Commit 9eb8fd6

Browse files
committed
Closing for today
1 parent 585d210 commit 9eb8fd6

File tree

9 files changed

+28
-30
lines changed

9 files changed

+28
-30
lines changed

Pascal.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
temp := b;
1313
b := a + b;
1414
a := temp;
15+
;
1516
end
1617
end.

Compiler.java renamed to StupsCompiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import java.io.*;
88

9-
public class Compiler {
9+
public class StupsCompiler {
1010

1111
public static void main(String[] args) throws LexerException, IOException, ParserException {
1212
String input = "";

out/production/projekt/Pascal.pas

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
b := 1;
99
while True do
1010
begin
11-
writeln(a)
11+
writeln(a);
1212
temp := b;
1313
b := a + b;
1414
a := temp;
15+
;
1516
end
1617
end.
-61 Bytes
Binary file not shown.
350 Bytes
Binary file not shown.

out/production/projekt/sablecc.scc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ Productions
142142
* Trivial stuff
143143
*/
144144
print {-> expr} =
145-
writeln l_par expression r_par semicolon
145+
writeln l_par expression r_par
146146
{-> New expr.print(expression.expr)};
147147

148148
assignment {-> expr} =
149-
identifier assign expression semicolon
149+
identifier assign expression
150150
{-> New expr.assignment(identifier, expression.expr)};
151151

152152
type {-> expr} =

parser/Parser.java

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,6 @@ ArrayList<Object> new24() /* reduce APrint */
10891089
{
10901090
@SuppressWarnings("hiding") ArrayList<Object> nodeList = new ArrayList<Object>();
10911091

1092-
@SuppressWarnings("unused") ArrayList<Object> nodeArrayList5 = pop();
10931092
@SuppressWarnings("unused") ArrayList<Object> nodeArrayList4 = pop();
10941093
@SuppressWarnings("unused") ArrayList<Object> nodeArrayList3 = pop();
10951094
@SuppressWarnings("unused") ArrayList<Object> nodeArrayList2 = pop();
@@ -1113,7 +1112,6 @@ ArrayList<Object> new25() /* reduce AAssignment */
11131112
{
11141113
@SuppressWarnings("hiding") ArrayList<Object> nodeList = new ArrayList<Object>();
11151114

1116-
@SuppressWarnings("unused") ArrayList<Object> nodeArrayList4 = pop();
11171115
@SuppressWarnings("unused") ArrayList<Object> nodeArrayList3 = pop();
11181116
@SuppressWarnings("unused") ArrayList<Object> nodeArrayList2 = pop();
11191117
@SuppressWarnings("unused") ArrayList<Object> nodeArrayList1 = pop();
@@ -1912,7 +1910,7 @@ ArrayList<Object> new57() /* reduce ANonTerminal$Statement */
19121910
{{-1, ERROR, 68}, {3, SHIFT, 31}, {32, SHIFT, 32}, {33, SHIFT, 33}, {34, SHIFT, 34}, {39, SHIFT, 35}, },
19131911
{{-1, ERROR, 69}, {5, SHIFT, 11}, {9, SHIFT, 13}, {12, SHIFT, 14}, {14, SHIFT, 15}, {15, SHIFT, 16}, {36, SHIFT, 17}, {39, SHIFT, 18}, },
19141912
{{-1, ERROR, 70}, {17, SHIFT, 95}, {23, SHIFT, 54}, {24, SHIFT, 55}, {25, SHIFT, 56}, {26, SHIFT, 57}, {27, SHIFT, 58}, {28, SHIFT, 59}, },
1915-
{{-1, ERROR, 71}, {23, SHIFT, 54}, {24, SHIFT, 55}, {25, SHIFT, 56}, {26, SHIFT, 57}, {27, SHIFT, 58}, {28, SHIFT, 59}, {36, SHIFT, 96}, },
1913+
{{-1, REDUCE, 25}, {23, SHIFT, 54}, {24, SHIFT, 55}, {25, SHIFT, 56}, {26, SHIFT, 57}, {27, SHIFT, 58}, {28, SHIFT, 59}, },
19161914
{{-1, REDUCE, 3}, },
19171915
{{-1, REDUCE, 4}, },
19181916
{{-1, ERROR, 74}, {5, SHIFT, 11}, {9, SHIFT, 13}, {12, SHIFT, 14}, {14, SHIFT, 15}, {15, SHIFT, 16}, {36, SHIFT, 17}, {39, SHIFT, 18}, },
@@ -1921,7 +1919,7 @@ ArrayList<Object> new57() /* reduce ANonTerminal$Statement */
19211919
{{-1, REDUCE, 13}, {11, REDUCE, 20}, },
19221920
{{-1, REDUCE, 14}, {11, REDUCE, 21}, },
19231921
{{-1, REDUCE, 51}, },
1924-
{{-1, ERROR, 80}, {11, SHIFT, 100}, },
1922+
{{-1, ERROR, 80}, {11, SHIFT, 99}, },
19251923
{{-1, REDUCE, 16}, },
19261924
{{-1, REDUCE, 11}, {11, REDUCE, 18}, },
19271925
{{-1, REDUCE, 10}, {11, REDUCE, 17}, },
@@ -1936,35 +1934,33 @@ ArrayList<Object> new57() /* reduce ANonTerminal$Statement */
19361934
{{-1, REDUCE, 35}, },
19371935
{{-1, REDUCE, 38}, },
19381936
{{-1, REDUCE, 23}, },
1939-
{{-1, ERROR, 95}, {36, SHIFT, 101}, },
1940-
{{-1, REDUCE, 25}, },
1941-
{{-1, ERROR, 97}, {5, SHIFT, 11}, {7, SHIFT, 102}, {9, SHIFT, 13}, {12, SHIFT, 14}, {14, SHIFT, 15}, {15, SHIFT, 16}, {36, SHIFT, 17}, {39, SHIFT, 18}, },
1942-
{{-1, ERROR, 98}, {10, SHIFT, 103}, {23, SHIFT, 54}, {24, SHIFT, 55}, {25, SHIFT, 56}, {26, SHIFT, 57}, {27, SHIFT, 58}, {28, SHIFT, 59}, },
1943-
{{-1, ERROR, 99}, {13, SHIFT, 104}, {23, SHIFT, 54}, {24, SHIFT, 55}, {25, SHIFT, 56}, {26, SHIFT, 57}, {27, SHIFT, 58}, {28, SHIFT, 59}, },
1944-
{{-1, ERROR, 100}, {5, SHIFT, 11}, {9, SHIFT, 13}, {12, SHIFT, 14}, {14, SHIFT, 15}, {15, SHIFT, 16}, {36, SHIFT, 17}, {39, SHIFT, 18}, },
19451937
{{-1, REDUCE, 24}, },
1938+
{{-1, ERROR, 96}, {5, SHIFT, 11}, {7, SHIFT, 100}, {9, SHIFT, 13}, {12, SHIFT, 14}, {14, SHIFT, 15}, {15, SHIFT, 16}, {36, SHIFT, 17}, {39, SHIFT, 18}, },
1939+
{{-1, ERROR, 97}, {10, SHIFT, 101}, {23, SHIFT, 54}, {24, SHIFT, 55}, {25, SHIFT, 56}, {26, SHIFT, 57}, {27, SHIFT, 58}, {28, SHIFT, 59}, },
1940+
{{-1, ERROR, 98}, {13, SHIFT, 102}, {23, SHIFT, 54}, {24, SHIFT, 55}, {25, SHIFT, 56}, {26, SHIFT, 57}, {27, SHIFT, 58}, {28, SHIFT, 59}, },
1941+
{{-1, ERROR, 99}, {5, SHIFT, 11}, {9, SHIFT, 13}, {12, SHIFT, 14}, {14, SHIFT, 15}, {15, SHIFT, 16}, {36, SHIFT, 17}, {39, SHIFT, 18}, },
19461942
{{-1, REDUCE, 12}, {11, REDUCE, 19}, },
1947-
{{-1, ERROR, 103}, {5, SHIFT, 74}, {9, SHIFT, 75}, {12, SHIFT, 76}, {14, SHIFT, 15}, {15, SHIFT, 77}, {36, SHIFT, 78}, {39, SHIFT, 18}, },
1948-
{{-1, ERROR, 104}, {5, SHIFT, 74}, {9, SHIFT, 75}, {12, SHIFT, 76}, {14, SHIFT, 15}, {15, SHIFT, 77}, {36, SHIFT, 78}, {39, SHIFT, 18}, },
1943+
{{-1, ERROR, 101}, {5, SHIFT, 74}, {9, SHIFT, 75}, {12, SHIFT, 76}, {14, SHIFT, 15}, {15, SHIFT, 77}, {36, SHIFT, 78}, {39, SHIFT, 18}, },
1944+
{{-1, ERROR, 102}, {5, SHIFT, 74}, {9, SHIFT, 75}, {12, SHIFT, 76}, {14, SHIFT, 15}, {15, SHIFT, 77}, {36, SHIFT, 78}, {39, SHIFT, 18}, },
19491945
{{-1, REDUCE, 52}, },
1950-
{{-1, ERROR, 106}, {11, SHIFT, 108}, },
1946+
{{-1, ERROR, 104}, {11, SHIFT, 106}, },
19511947
{{-1, REDUCE, 22}, },
1952-
{{-1, ERROR, 108}, {5, SHIFT, 74}, {9, SHIFT, 75}, {12, SHIFT, 76}, {14, SHIFT, 15}, {15, SHIFT, 77}, {36, SHIFT, 78}, {39, SHIFT, 18}, },
1948+
{{-1, ERROR, 106}, {5, SHIFT, 74}, {9, SHIFT, 75}, {12, SHIFT, 76}, {14, SHIFT, 15}, {15, SHIFT, 77}, {36, SHIFT, 78}, {39, SHIFT, 18}, },
19531949
{{-1, REDUCE, 53}, },
19541950
};*/
19551951
private static int[][][] gotoTable;
19561952
/* {
19571953
{{-1, 2}, },
19581954
{{-1, 7}, {8, 27}, },
19591955
{{-1, 10}, },
1960-
{{-1, 19}, {25, 44}, {30, 44}, {46, 44}, {53, 79}, {69, 94}, {97, 44}, {100, 105}, {103, 79}, {104, 94}, {108, 105}, },
1961-
{{-1, 80}, {103, 106}, {104, 107}, {108, 109}, },
1956+
{{-1, 19}, {25, 44}, {30, 44}, {46, 44}, {53, 79}, {69, 94}, {96, 44}, {99, 103}, {101, 79}, {102, 94}, {106, 103}, },
1957+
{{-1, 80}, {101, 104}, {102, 105}, {106, 107}, },
19621958
{{-1, 81}, },
19631959
{{-1, 20}, },
1964-
{{-1, 21}, {53, 82}, {103, 82}, {104, 82}, {108, 82}, },
1965-
{{-1, 22}, {53, 83}, {103, 83}, {104, 83}, {108, 83}, },
1960+
{{-1, 21}, {53, 82}, {101, 82}, {102, 82}, {106, 82}, },
1961+
{{-1, 22}, {53, 83}, {101, 83}, {102, 83}, {106, 83}, },
19661962
{{-1, 49}, },
1967-
{{-1, 36}, {14, 40}, {41, 70}, {42, 71}, {75, 98}, {76, 99}, },
1963+
{{-1, 36}, {14, 40}, {41, 70}, {42, 71}, {75, 97}, {76, 98}, },
19681964
{{-1, 37}, {60, 85}, },
19691965
{{-1, 38}, {61, 86}, {62, 87}, {63, 88}, {64, 89}, },
19701966
{{-1, 39}, {32, 52}, {65, 90}, {66, 91}, {67, 92}, {68, 93}, },
@@ -1973,7 +1969,7 @@ ArrayList<Object> new57() /* reduce ANonTerminal$Statement */
19731969
{{-1, 24}, },
19741970
{{-1, 84}, },
19751971
{{-1, 8}, },
1976-
{{-1, 25}, {11, 30}, {26, 46}, {74, 97}, },
1972+
{{-1, 25}, {11, 30}, {26, 46}, {74, 96}, },
19771973
};*/
19781974
private static String[] errorMessages;
19791975
/* {
@@ -1991,18 +1987,18 @@ ArrayList<Object> new57() /* reduce ANonTerminal$Statement */
19911987
"expecting: ':='",
19921988
"expecting: integer, boolean",
19931989
"expecting: begin, end, if, while, writeln, break, ';', identifier",
1994-
"expecting: then, do, ')', '+', '-', '*', div, mod, '=', '<', '>', '<=', '>=', '<>', and, or, xor, ';'",
1990+
"expecting: begin, programend, end, if, then, else, while, do, writeln, break, ')', '+', '-', '*', div, mod, '=', '<', '>', '<=', '>=', '<>', and, or, xor, ';', identifier",
19951991
"expecting: then, '=', '<', '>', '<=', '>=', '<>'",
1996-
"expecting: then, do, ')', '+', '-', '=', '<', '>', '<=', '>=', '<>', or, xor, ';'",
1992+
"expecting: begin, programend, end, if, then, else, while, do, writeln, break, ')', '+', '-', '=', '<', '>', '<=', '>=', '<>', or, xor, ';', identifier",
19971993
"expecting: do, '=', '<', '>', '<=', '>=', '<>'",
19981994
"expecting: ')', '=', '<', '>', '<=', '>=', '<>'",
1999-
"expecting: '=', '<', '>', '<=', '>=', '<>', ';'",
1995+
"expecting: begin, programend, end, if, else, while, writeln, break, '=', '<', '>', '<=', '>=', '<>', ';', identifier",
20001996
"expecting: begin, programend, end, if, else, while, writeln, break, ';', identifier",
20011997
"expecting: else",
20021998
};*/
20031999
private static int[] errors;
20042000
/* {
2005-
0, 1, 2, 3, 4, 1, 5, 4, 4, 6, 6, 7, 2, 8, 8, 9, 10, 10, 11, 10, 10, 10, 10, 10, 10, 5, 5, 4, 12, 1, 13, 14, 8, 14, 14, 14, 15, 16, 14, 14, 17, 8, 8, 2, 10, 2, 5, 3, 3, 3, 6, 10, 14, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 18, 19, 2, 4, 7, 8, 8, 20, 20, 10, 21, 21, 20, 20, 21, 16, 14, 14, 14, 14, 14, 14, 14, 14, 10, 3, 20, 13, 15, 17, 7, 20, 20, 7, 7, 10, 21, 21, 7, 21,
2001+
0, 1, 2, 3, 4, 1, 5, 4, 4, 6, 6, 7, 2, 8, 8, 9, 10, 10, 11, 10, 10, 10, 10, 10, 10, 5, 5, 4, 12, 1, 13, 14, 8, 14, 14, 14, 15, 16, 14, 14, 17, 8, 8, 2, 10, 2, 5, 3, 3, 3, 6, 10, 14, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 18, 19, 2, 4, 7, 8, 8, 20, 20, 10, 21, 21, 20, 20, 21, 16, 14, 14, 14, 14, 14, 14, 14, 14, 10, 20, 13, 15, 17, 7, 20, 7, 7, 10, 21, 21, 7, 21,
20062002
};*/
20072003

20082004
static

parser/parser.dat

350 Bytes
Binary file not shown.

sablecc.scc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ Productions
142142
* Trivial stuff
143143
*/
144144
print {-> expr} =
145-
writeln l_par expression r_par semicolon
145+
writeln l_par expression r_par
146146
{-> New expr.print(expression.expr)};
147147

148148
assignment {-> expr} =
149-
identifier assign expression semicolon
149+
identifier assign expression
150150
{-> New expr.assignment(identifier, expression.expr)};
151151

152152
type {-> expr} =

0 commit comments

Comments
 (0)