Add semi-working Stuff
This commit is contained in:
commit
910c065a97
BIN
ADDITION.class
Normal file
BIN
ADDITION.class
Normal file
Binary file not shown.
BIN
AUFKLAMMER.class
Normal file
BIN
AUFKLAMMER.class
Normal file
Binary file not shown.
BIN
MULTI.class
Normal file
BIN
MULTI.class
Normal file
Binary file not shown.
BIN
Main.class
Normal file
BIN
Main.class
Normal file
Binary file not shown.
13
Main.java
Normal file
13
Main.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
public class Main {
|
||||||
|
public static void main (String [] args) {
|
||||||
|
browserscanner scanner =
|
||||||
|
new browserscanner
|
||||||
|
(new java.io.InputStreamReader (System.in));
|
||||||
|
browserparser parser = new browserparser() ;
|
||||||
|
try {
|
||||||
|
parser.yyparse(scanner);
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}}
|
17
Makefile
Normal file
17
Makefile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
Main.class: Main.java yyTokenclass.class browserscanner.class
|
||||||
|
javac Main.java
|
||||||
|
|
||||||
|
yyTokenclass.class: browserparser.java
|
||||||
|
javac browserparser.java
|
||||||
|
|
||||||
|
browserscanner.class: browserlexer.java
|
||||||
|
javac browserlexer.java
|
||||||
|
|
||||||
|
browserlexer.java: browserlexer
|
||||||
|
java -cp JLex2.jar JLex2.Main browserlexer
|
||||||
|
|
||||||
|
browserparser.java: browserparser.jay skeleton.jaooy
|
||||||
|
jaooy -v browserparser.jay < skeleton.jaooy > browserparser.java
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f *.class browserlexer.java browserparser.java
|
BIN
SUBTRA.class
Normal file
BIN
SUBTRA.class
Normal file
Binary file not shown.
0
Taschenrechner.lex.java
Normal file
0
Taschenrechner.lex.java
Normal file
1
Taschenrechner.txt
Normal file
1
Taschenrechner.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Hallo Mama
|
BIN
ZUKLAMMER.class
Normal file
BIN
ZUKLAMMER.class
Normal file
Binary file not shown.
23
browserlexer
Normal file
23
browserlexer
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
%%
|
||||||
|
%public
|
||||||
|
%class browserlexer
|
||||||
|
%jayscanner browserscanner
|
||||||
|
%jayparser browserparser
|
||||||
|
%eofval{
|
||||||
|
System.out.println("EOF reached");
|
||||||
|
return new EOF();
|
||||||
|
%eofval}
|
||||||
|
|
||||||
|
ws = [ \t\b\r\n\015]+
|
||||||
|
num = [1-9][0-9]*
|
||||||
|
|
||||||
|
%%
|
||||||
|
|
||||||
|
{ws} { return new WS(yytext()); }
|
||||||
|
{num} { return new NUM(yytext()); }
|
||||||
|
"(" { return new AUFKLAMMER(yytext()); }
|
||||||
|
")" { return new ZUKLAMMER(yytext()); }
|
||||||
|
"+" { return new ADDITION(yytext()); }
|
||||||
|
"-" { return new SUBTRA(yytext()); }
|
||||||
|
"*" { return new MULTI(yytext()); }
|
||||||
|
"/" { return new DIV(yytext()); }
|
BIN
browserlexer.class
Normal file
BIN
browserlexer.class
Normal file
Binary file not shown.
326
browserlexer.java
Normal file
326
browserlexer.java
Normal file
@ -0,0 +1,326 @@
|
|||||||
|
|
||||||
|
|
||||||
|
public class browserlexer {
|
||||||
|
private final int YY_BUFFER_SIZE = 512;
|
||||||
|
private final int YY_F = -1;
|
||||||
|
private final int YY_NO_STATE = -1;
|
||||||
|
private final int YY_NOT_ACCEPT = 0;
|
||||||
|
private final int YY_START = 1;
|
||||||
|
private final int YY_END = 2;
|
||||||
|
private final int YY_NO_ANCHOR = 4;
|
||||||
|
private final int YY_BOL = 128;
|
||||||
|
private final int YY_EOF = 129;
|
||||||
|
private java.io.BufferedReader yy_reader;
|
||||||
|
private int yy_buffer_index;
|
||||||
|
private int yy_buffer_read;
|
||||||
|
private int yy_buffer_start;
|
||||||
|
private int yy_buffer_end;
|
||||||
|
private char yy_buffer[];
|
||||||
|
private boolean yy_at_bol;
|
||||||
|
private int yy_lexical_state;
|
||||||
|
|
||||||
|
public browserlexer (java.io.Reader reader) {
|
||||||
|
this ();
|
||||||
|
if (null == reader) {
|
||||||
|
throw (new Error("Error: Bad input stream initializer."));
|
||||||
|
}
|
||||||
|
yy_reader = new java.io.BufferedReader(reader);
|
||||||
|
}
|
||||||
|
|
||||||
|
public browserlexer (java.io.InputStream instream) {
|
||||||
|
this ();
|
||||||
|
if (null == instream) {
|
||||||
|
throw (new Error("Error: Bad input stream initializer."));
|
||||||
|
}
|
||||||
|
yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream));
|
||||||
|
}
|
||||||
|
|
||||||
|
private browserlexer () {
|
||||||
|
yy_buffer = new char[YY_BUFFER_SIZE];
|
||||||
|
yy_buffer_read = 0;
|
||||||
|
yy_buffer_index = 0;
|
||||||
|
yy_buffer_start = 0;
|
||||||
|
yy_buffer_end = 0;
|
||||||
|
yy_at_bol = true;
|
||||||
|
yy_lexical_state = YYINITIAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean yy_eof_done = false;
|
||||||
|
private final int YYINITIAL = 0;
|
||||||
|
private final int yy_state_dtrans[] = {
|
||||||
|
0
|
||||||
|
};
|
||||||
|
private void yybegin (int state) {
|
||||||
|
yy_lexical_state = state;
|
||||||
|
}
|
||||||
|
private int yy_advance ()
|
||||||
|
throws java.io.IOException {
|
||||||
|
int next_read;
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
|
||||||
|
if (yy_buffer_index < yy_buffer_read) {
|
||||||
|
return yy_buffer[yy_buffer_index++];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (0 != yy_buffer_start) {
|
||||||
|
i = yy_buffer_start;
|
||||||
|
j = 0;
|
||||||
|
while (i < yy_buffer_read) {
|
||||||
|
yy_buffer[j] = yy_buffer[i];
|
||||||
|
++i;
|
||||||
|
++j;
|
||||||
|
}
|
||||||
|
yy_buffer_end = yy_buffer_end - yy_buffer_start;
|
||||||
|
yy_buffer_start = 0;
|
||||||
|
yy_buffer_read = j;
|
||||||
|
yy_buffer_index = j;
|
||||||
|
next_read = yy_reader.read(yy_buffer,
|
||||||
|
yy_buffer_read,
|
||||||
|
yy_buffer.length - yy_buffer_read);
|
||||||
|
if (-1 == next_read) {
|
||||||
|
return YY_EOF;
|
||||||
|
}
|
||||||
|
yy_buffer_read = yy_buffer_read + next_read;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (yy_buffer_index >= yy_buffer_read) {
|
||||||
|
if (yy_buffer_index >= yy_buffer.length) {
|
||||||
|
yy_buffer = yy_double(yy_buffer);
|
||||||
|
}
|
||||||
|
next_read = yy_reader.read(yy_buffer,
|
||||||
|
yy_buffer_read,
|
||||||
|
yy_buffer.length - yy_buffer_read);
|
||||||
|
if (-1 == next_read) {
|
||||||
|
return YY_EOF;
|
||||||
|
}
|
||||||
|
yy_buffer_read = yy_buffer_read + next_read;
|
||||||
|
}
|
||||||
|
return yy_buffer[yy_buffer_index++];
|
||||||
|
}
|
||||||
|
private void yy_move_end () {
|
||||||
|
if (yy_buffer_end > yy_buffer_start &&
|
||||||
|
'\n' == yy_buffer[yy_buffer_end-1])
|
||||||
|
yy_buffer_end--;
|
||||||
|
if (yy_buffer_end > yy_buffer_start &&
|
||||||
|
'\r' == yy_buffer[yy_buffer_end-1])
|
||||||
|
yy_buffer_end--;
|
||||||
|
}
|
||||||
|
private boolean yy_last_was_cr=false;
|
||||||
|
private void yy_mark_start () {
|
||||||
|
yy_buffer_start = yy_buffer_index;
|
||||||
|
}
|
||||||
|
private void yy_mark_end () {
|
||||||
|
yy_buffer_end = yy_buffer_index;
|
||||||
|
}
|
||||||
|
private void yy_to_mark () {
|
||||||
|
yy_buffer_index = yy_buffer_end;
|
||||||
|
yy_at_bol = (yy_buffer_end > yy_buffer_start) &&
|
||||||
|
('\r' == yy_buffer[yy_buffer_end-1] ||
|
||||||
|
'\n' == yy_buffer[yy_buffer_end-1] ||
|
||||||
|
2028/*LS*/ == yy_buffer[yy_buffer_end-1] ||
|
||||||
|
2029/*PS*/ == yy_buffer[yy_buffer_end-1]);
|
||||||
|
}
|
||||||
|
private java.lang.String yytext () {
|
||||||
|
return (new java.lang.String(yy_buffer,
|
||||||
|
yy_buffer_start,
|
||||||
|
yy_buffer_end - yy_buffer_start));
|
||||||
|
}
|
||||||
|
private int yylength () {
|
||||||
|
return yy_buffer_end - yy_buffer_start;
|
||||||
|
}
|
||||||
|
private char[] yy_double (char buf[]) {
|
||||||
|
int i;
|
||||||
|
char newbuf[];
|
||||||
|
newbuf = new char[2*buf.length];
|
||||||
|
for (i = 0; i < buf.length; ++i) {
|
||||||
|
newbuf[i] = buf[i];
|
||||||
|
}
|
||||||
|
return newbuf;
|
||||||
|
}
|
||||||
|
private final int YY_E_INTERNAL = 0;
|
||||||
|
private final int YY_E_MATCH = 1;
|
||||||
|
private java.lang.String yy_error_string[] = {
|
||||||
|
"Error: Internal error.\n",
|
||||||
|
"Error: Unmatched input.\n"
|
||||||
|
};
|
||||||
|
private void yy_error (int code,boolean fatal) {
|
||||||
|
java.lang.System.out.print(yy_error_string[code]);
|
||||||
|
java.lang.System.out.flush();
|
||||||
|
if (fatal) {
|
||||||
|
throw new Error("Fatal Error.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int[][] unpackFromString(int size1, int size2, String st) {
|
||||||
|
int colonIndex = -1;
|
||||||
|
String lengthString;
|
||||||
|
int sequenceLength = 0;
|
||||||
|
int sequenceInteger = 0;
|
||||||
|
|
||||||
|
int commaIndex;
|
||||||
|
String workString;
|
||||||
|
|
||||||
|
int res[][] = new int[size1][size2];
|
||||||
|
for (int i= 0; i < size1; i++) {
|
||||||
|
for (int j= 0; j < size2; j++) {
|
||||||
|
if (sequenceLength != 0) {
|
||||||
|
res[i][j] = sequenceInteger;
|
||||||
|
sequenceLength--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
commaIndex = st.indexOf(',');
|
||||||
|
workString = (commaIndex==-1) ? st :
|
||||||
|
st.substring(0, commaIndex);
|
||||||
|
st = st.substring(commaIndex+1);
|
||||||
|
colonIndex = workString.indexOf(':');
|
||||||
|
if (colonIndex == -1) {
|
||||||
|
res[i][j]=Integer.parseInt(workString);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
lengthString =
|
||||||
|
workString.substring(colonIndex+1);
|
||||||
|
sequenceLength=Integer.parseInt(lengthString);
|
||||||
|
workString=workString.substring(0,colonIndex);
|
||||||
|
sequenceInteger=Integer.parseInt(workString);
|
||||||
|
res[i][j] = sequenceInteger;
|
||||||
|
sequenceLength--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
private int yy_acpt[] = {
|
||||||
|
/* 0 */ YY_NOT_ACCEPT,
|
||||||
|
/* 1 */ YY_NO_ANCHOR,
|
||||||
|
/* 2 */ YY_NO_ANCHOR,
|
||||||
|
/* 3 */ YY_NO_ANCHOR,
|
||||||
|
/* 4 */ YY_NO_ANCHOR,
|
||||||
|
/* 5 */ YY_NO_ANCHOR,
|
||||||
|
/* 6 */ YY_NO_ANCHOR,
|
||||||
|
/* 7 */ YY_NO_ANCHOR,
|
||||||
|
/* 8 */ YY_NO_ANCHOR,
|
||||||
|
/* 9 */ YY_NO_ANCHOR
|
||||||
|
};
|
||||||
|
private int yy_cmap[] = unpackFromString(1,130,
|
||||||
|
"0:8,1:3,0:2,1,0:18,1,0:7,4,5,8,6,0,7,0,9,3,2:9,0:70,10:2")[0];
|
||||||
|
|
||||||
|
private int yy_rmap[] = unpackFromString(1,10,
|
||||||
|
"0,1,2,3:7")[0];
|
||||||
|
|
||||||
|
private int yy_nxt[][] = unpackFromString(4,11,
|
||||||
|
"-1,1,2,-1,3,4,5,6,7,8,9,-1,1,-1:11,2:2,-1:18");
|
||||||
|
|
||||||
|
public yyTokenclass yylex ()
|
||||||
|
throws java.io.IOException {
|
||||||
|
int yy_lookahead;
|
||||||
|
int yy_anchor = YY_NO_ANCHOR;
|
||||||
|
int yy_state = yy_state_dtrans[yy_lexical_state];
|
||||||
|
int yy_next_state = YY_NO_STATE;
|
||||||
|
int yy_last_accept_state = YY_NO_STATE;
|
||||||
|
boolean yy_initial = true;
|
||||||
|
int yy_this_accept;
|
||||||
|
|
||||||
|
yy_mark_start();
|
||||||
|
yy_this_accept = yy_acpt[yy_state];
|
||||||
|
if (YY_NOT_ACCEPT != yy_this_accept) {
|
||||||
|
yy_last_accept_state = yy_state;
|
||||||
|
yy_mark_end();
|
||||||
|
}
|
||||||
|
while (true) {
|
||||||
|
if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL;
|
||||||
|
else yy_lookahead = yy_advance();
|
||||||
|
yy_next_state = YY_F;
|
||||||
|
yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
|
||||||
|
if (YY_EOF == yy_lookahead && true == yy_initial) {
|
||||||
|
|
||||||
|
System.out.println("EOF reached");
|
||||||
|
return new EOF();
|
||||||
|
}
|
||||||
|
if (YY_F != yy_next_state) {
|
||||||
|
yy_state = yy_next_state;
|
||||||
|
yy_initial = false;
|
||||||
|
yy_this_accept = yy_acpt[yy_state];
|
||||||
|
if (YY_NOT_ACCEPT != yy_this_accept) {
|
||||||
|
yy_last_accept_state = yy_state;
|
||||||
|
yy_mark_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (YY_NO_STATE == yy_last_accept_state) {
|
||||||
|
throw (new Error("Lexical Error: Unmatched Input."));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
yy_anchor = yy_acpt[yy_last_accept_state];
|
||||||
|
if (0 != (YY_END & yy_anchor)) {
|
||||||
|
yy_move_end();
|
||||||
|
}
|
||||||
|
yy_to_mark();
|
||||||
|
switch (yy_last_accept_state) {
|
||||||
|
case 1:
|
||||||
|
{ return new WS(yytext()); }
|
||||||
|
case -2:
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{ return new NUM(yytext()); }
|
||||||
|
case -3:
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
{ return new AUFKLAMMER(yytext()); }
|
||||||
|
case -4:
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
{ return new ZUKLAMMER(yytext()); }
|
||||||
|
case -5:
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
{ return new ADDITION(yytext()); }
|
||||||
|
case -6:
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
{ return new SUBTRA(yytext()); }
|
||||||
|
case -7:
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
{ return new MULTI(yytext()); }
|
||||||
|
case -8:
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
{ return new DIV(yytext()); }
|
||||||
|
case -9:
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
|
||||||
|
case -10:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
yy_error(YY_E_INTERNAL,false);
|
||||||
|
case -1:
|
||||||
|
}
|
||||||
|
yy_initial = true;
|
||||||
|
yy_state = yy_state_dtrans[yy_lexical_state];
|
||||||
|
yy_next_state = YY_NO_STATE;
|
||||||
|
yy_last_accept_state = YY_NO_STATE;
|
||||||
|
yy_mark_start();
|
||||||
|
yy_this_accept = yy_acpt[yy_state];
|
||||||
|
if (YY_NOT_ACCEPT != yy_this_accept) {
|
||||||
|
yy_last_accept_state = yy_state;
|
||||||
|
yy_mark_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class browserscanner extends browserlexer implements browserparser.yyInput {
|
||||||
|
public browserscanner (java.io.Reader reader) {
|
||||||
|
super (reader);
|
||||||
|
}
|
||||||
|
//public int token() is not longer necessary
|
||||||
|
|
||||||
|
public yyTokenclass advance() throws java.io.IOException {
|
||||||
|
yyTokenclass ret = yylex();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
//public Object value () is not longer necessary
|
||||||
|
|
||||||
|
}
|
62
browserlexer2
Executable file
62
browserlexer2
Executable file
@ -0,0 +1,62 @@
|
|||||||
|
%%
|
||||||
|
%public
|
||||||
|
%class browserlexer
|
||||||
|
%type int
|
||||||
|
%eofval{
|
||||||
|
System.out.println("EOF reached");
|
||||||
|
return -1;
|
||||||
|
%eofval}
|
||||||
|
|
||||||
|
a = (a|A)
|
||||||
|
b = (b|B)
|
||||||
|
c = (c|C)
|
||||||
|
d = (d|D)
|
||||||
|
e = (e|E)
|
||||||
|
f = (f|F)
|
||||||
|
g = (g|G)
|
||||||
|
h = (h|H)
|
||||||
|
i = (i|I)
|
||||||
|
j = (j|J)
|
||||||
|
k = (k|K)
|
||||||
|
l = (l|L)
|
||||||
|
m = (m|M)
|
||||||
|
n = (n|N)
|
||||||
|
o = (o|O)
|
||||||
|
p = (p|P)
|
||||||
|
q = (q|Q)
|
||||||
|
r = (r|R)
|
||||||
|
s = (s|S)
|
||||||
|
t = (t|T)
|
||||||
|
u = (u|U)
|
||||||
|
v = (v|V)
|
||||||
|
w = (w|W)
|
||||||
|
x = (x|X)
|
||||||
|
y = (y|Y)
|
||||||
|
z = (z|Z)
|
||||||
|
ws = [ \t\r\n\b\015]+
|
||||||
|
|
||||||
|
%%
|
||||||
|
"<"(h|H)(t|T)(m|M)(l|L)">" { System.out.println(yytext()); }
|
||||||
|
"</"(h|H)(t|T)(m|M)(l|L)">" { System.out.println(yytext()); }
|
||||||
|
"<"(h|H){e}{a}{d}">" { System.out.println(yytext()); }
|
||||||
|
"</"(h|H){e}{a}{d}">" { System.out.println(yytext()); }
|
||||||
|
"<"(t|T){i}(t|T)(l|L){e}">" { System.out.println(yytext()); }
|
||||||
|
"</"(t|T){i}(t|T)(l|L){e}">" { System.out.println(yytext()); }
|
||||||
|
"<"{b}{o}{d}{y}">" { System.out.println(yytext()); }
|
||||||
|
"</"{b}{o}{d}{y}">" { System.out.println(yytext()); }
|
||||||
|
"<"{h}1">" { System.out.println(yytext()); }
|
||||||
|
"</"{h}1">" { System.out.println(yytext()); }
|
||||||
|
"<"{h}2">" { System.out.println(yytext()); }
|
||||||
|
"</"{h}2">" { System.out.println(yytext()); }
|
||||||
|
"<"{h}3">" { System.out.println(yytext()); }
|
||||||
|
"</"{h}3">" { System.out.println(yytext()); }
|
||||||
|
"<"{b}">" { System.out.println(yytext()); }
|
||||||
|
"</"{b}">" { System.out.println(yytext()); }
|
||||||
|
"<"{c}{e}{n}(t|T){e}{r}">" { System.out.println(yytext()); }
|
||||||
|
"</"{c}{e}{n}(t|T){e}{r}">" { System.out.println(yytext()); }
|
||||||
|
"<"{e}(m|M)">" { System.out.println(yytext()); }
|
||||||
|
"</"{e}(m|M)">" { System.out.println(yytext()); }
|
||||||
|
"<"{p}">" { System.out.println(yytext()); }
|
||||||
|
"</"{p}">" { System.out.println(yytext()); }
|
||||||
|
{ws} { System.out.println(yytext()); }
|
||||||
|
[^\<]+ { System.out.println(yytext()); }
|
BIN
browserparser$YyCheckClass.class
Normal file
BIN
browserparser$YyCheckClass.class
Normal file
Binary file not shown.
BIN
browserparser$YyDefRedClass.class
Normal file
BIN
browserparser$YyDefRedClass.class
Normal file
Binary file not shown.
BIN
browserparser$YyDgotoClass.class
Normal file
BIN
browserparser$YyDgotoClass.class
Normal file
Binary file not shown.
BIN
browserparser$YyGindexClass.class
Normal file
BIN
browserparser$YyGindexClass.class
Normal file
Binary file not shown.
BIN
browserparser$YyLenClass.class
Normal file
BIN
browserparser$YyLenClass.class
Normal file
Binary file not shown.
BIN
browserparser$YyLhsClass.class
Normal file
BIN
browserparser$YyLhsClass.class
Normal file
Binary file not shown.
BIN
browserparser$YyNameClass.class
Normal file
BIN
browserparser$YyNameClass.class
Normal file
Binary file not shown.
BIN
browserparser$YyRindexClass.class
Normal file
BIN
browserparser$YyRindexClass.class
Normal file
Binary file not shown.
BIN
browserparser$YySindexClass.class
Normal file
BIN
browserparser$YySindexClass.class
Normal file
Binary file not shown.
BIN
browserparser$YyTableClass.class
Normal file
BIN
browserparser$YyTableClass.class
Normal file
Binary file not shown.
BIN
browserparser$yyCheck0.class
Normal file
BIN
browserparser$yyCheck0.class
Normal file
Binary file not shown.
BIN
browserparser$yyException.class
Normal file
BIN
browserparser$yyException.class
Normal file
Binary file not shown.
BIN
browserparser$yyInput.class
Normal file
BIN
browserparser$yyInput.class
Normal file
Binary file not shown.
BIN
browserparser$yyTable0.class
Normal file
BIN
browserparser$yyTable0.class
Normal file
Binary file not shown.
BIN
browserparser.class
Normal file
BIN
browserparser.class
Normal file
Binary file not shown.
564
browserparser.java
Normal file
564
browserparser.java
Normal file
@ -0,0 +1,564 @@
|
|||||||
|
// created by jay 0.8 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
|
||||||
|
|
||||||
|
// line 2 "browserparser.jay"
|
||||||
|
class browserparser {
|
||||||
|
// line 6 "-"
|
||||||
|
yyError yytemperror = new yyError();
|
||||||
|
public final int yyErrorCode = yytemperror.tokennr;
|
||||||
|
|
||||||
|
/** thrown for irrecoverable syntax errors and stack overflow.
|
||||||
|
*/
|
||||||
|
public static class yyException extends java.lang.Exception {
|
||||||
|
public yyException (String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** must be implemented by a scanner object to supply input to the parser.
|
||||||
|
*/
|
||||||
|
public interface yyInput {
|
||||||
|
/** move on to next token.
|
||||||
|
@return false if positioned beyond tokens.
|
||||||
|
@throws IOException on input error.
|
||||||
|
*/
|
||||||
|
/** modified by diho, 10.04.2004 */
|
||||||
|
yyTokenclass advance () throws java.io.IOException;
|
||||||
|
/** classifies current token.
|
||||||
|
Should not be called if advance() returned false.
|
||||||
|
@return current %token or single character.
|
||||||
|
*/
|
||||||
|
/** modified by diho, 10.04.2004 token () is not longer necessary,
|
||||||
|
advance () supplies token or null
|
||||||
|
int token (); */
|
||||||
|
|
||||||
|
|
||||||
|
/** associated with current token.
|
||||||
|
Should not be called if advance() returned false.
|
||||||
|
@return value for token().
|
||||||
|
*/
|
||||||
|
/** modified by diho, 10.04.2004 value () is not longer necessary,
|
||||||
|
Token value can be retrieved from Token itself.
|
||||||
|
Object value ();*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/** simplified error message.
|
||||||
|
@see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
|
||||||
|
*/
|
||||||
|
public void yyerror (String message) {
|
||||||
|
yyerror(message, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** (syntax) error message.
|
||||||
|
Can be overwritten to control message format.
|
||||||
|
@param message text to be displayed.
|
||||||
|
@param expected vector of acceptable tokens, if available.
|
||||||
|
*/
|
||||||
|
public void yyerror (String message, String[] expected) {
|
||||||
|
if (expected != null && expected.length > 0) {
|
||||||
|
System.err.print(message+", expecting");
|
||||||
|
for (int n = 0; n < expected.length; ++ n)
|
||||||
|
System.err.print(" "+expected[n]);
|
||||||
|
System.err.println();
|
||||||
|
} else
|
||||||
|
System.err.println(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** debugging support, requires the package jay.yydebug.
|
||||||
|
Set to null to suppress debugging messages.
|
||||||
|
*/
|
||||||
|
//t protected jay.yydebug.yyDebug yydebug;
|
||||||
|
|
||||||
|
protected static final int yyFinal = 2;
|
||||||
|
|
||||||
|
/** index-checked interface to yyName[].
|
||||||
|
@param token single character or %token value.
|
||||||
|
@return token name or [illegal] or [unknown].
|
||||||
|
*/
|
||||||
|
//t public static final String yyname (int token) {
|
||||||
|
//t if (token < 0 || token > YyNameClass.yyName.length) return "[illegal]";
|
||||||
|
//t String name;
|
||||||
|
//t if ((name = YyNameClass.yyName[token]) != null) return name;
|
||||||
|
//t return "[unknown]";
|
||||||
|
//t }
|
||||||
|
|
||||||
|
/** computes list of expected tokens on error by tracing the tables.
|
||||||
|
@param state for which to compute the list.
|
||||||
|
@return list of token names.
|
||||||
|
*/
|
||||||
|
protected String[] yyExpecting (int state) {
|
||||||
|
int token, n, len = 0;
|
||||||
|
boolean[] ok = new boolean[YyNameClass.yyName.length];
|
||||||
|
|
||||||
|
if ((n = YySindexClass.yySindex[state]) != 0)
|
||||||
|
for (token = n < 0 ? -n : 0;
|
||||||
|
token < YyNameClass.yyName.length && n+token < YyTableClass.yyTable.length; ++ token)
|
||||||
|
if (YyCheckClass.yyCheck[n+token] == token && !ok[token] && YyNameClass.yyName[token] != null) {
|
||||||
|
++ len;
|
||||||
|
ok[token] = true;
|
||||||
|
}
|
||||||
|
if ((n = YyRindexClass.yyRindex[state]) != 0)
|
||||||
|
for (token = n < 0 ? -n : 0;
|
||||||
|
token < YyNameClass.yyName.length && n+token < YyTableClass.yyTable.length; ++ token)
|
||||||
|
if (YyCheckClass.yyCheck[n+token] == token && !ok[token] && YyNameClass.yyName[token] != null) {
|
||||||
|
++ len;
|
||||||
|
ok[token] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String result[] = new String[len];
|
||||||
|
for (n = token = 0; n < len; ++ token)
|
||||||
|
if (ok[token]) result[n++] = YyNameClass.yyName[token];
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** the generated parser, with debugging messages.
|
||||||
|
Maintains a state and a value stack, currently with fixed maximum size.
|
||||||
|
@param yyLex scanner.
|
||||||
|
@param yydebug debug message writer implementing yyDebug, or null.
|
||||||
|
@return result of the last reduction, if any.
|
||||||
|
@throws yyException on irrecoverable parse error.
|
||||||
|
*/
|
||||||
|
public Object yyparse (yyInput yyLex, Object yydebug)
|
||||||
|
throws java.io.IOException, yyException {
|
||||||
|
//t this.yydebug = (jay.yydebug.yyDebug)yydebug;
|
||||||
|
return yyparse(yyLex);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** initial size and increment of the state/value stack [default 256].
|
||||||
|
This is not final so that it can be overwritten outside of invocations
|
||||||
|
of yyparse().
|
||||||
|
*/
|
||||||
|
protected int yyMax;
|
||||||
|
|
||||||
|
/** executed at the beginning of a reduce action.
|
||||||
|
Used as $$ = yyDefault($1), prior to the user-specified action, if any.
|
||||||
|
Can be overwritten to provide deep copy, etc.
|
||||||
|
@param first value for $1, or null.
|
||||||
|
@return first.
|
||||||
|
*/
|
||||||
|
protected Object yyDefault (Object first) {
|
||||||
|
return first;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** the generated parser.
|
||||||
|
Maintains a state and a value stack, currently with fixed maximum size.
|
||||||
|
@param yyLex scanner.
|
||||||
|
@return result of the last reduction, if any.
|
||||||
|
@throws yyException on irrecoverable parse error.
|
||||||
|
*/
|
||||||
|
public Object yyparse (yyInput yyLex)
|
||||||
|
throws java.io.IOException, yyException {
|
||||||
|
YyCheckClass.yyCheckInit(); // initial yyCheck eingefuegt PL 05-03-08
|
||||||
|
YyTableClass.yyTableInit(); // initial yyCheck eingefuegt PL 05-03-08
|
||||||
|
if (yyMax <= 0) yyMax = 256; // initial size
|
||||||
|
int yyState = 0, yyStates[] = new int[yyMax]; // state stack
|
||||||
|
Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack
|
||||||
|
/*modified by diho, 14.04.2004
|
||||||
|
orig: int yyToken = -1 was replaced by "empty Token"*/
|
||||||
|
yyTokenclass yyToken = new yyTokenclass(); // current input
|
||||||
|
int yyErrorFlag = 0; // #tks to shift
|
||||||
|
|
||||||
|
yyLoop: for (int yyTop = 0;; ++ yyTop) {
|
||||||
|
if (yyTop >= yyStates.length) { // dynamically increase
|
||||||
|
int[] i = new int[yyStates.length+yyMax];
|
||||||
|
System.arraycopy(yyStates, 0, i, 0, yyStates.length);
|
||||||
|
yyStates = i;
|
||||||
|
Object[] o = new Object[yyVals.length+yyMax];
|
||||||
|
System.arraycopy(yyVals, 0, o, 0, yyVals.length);
|
||||||
|
yyVals = o;
|
||||||
|
}
|
||||||
|
yyStates[yyTop] = yyState;
|
||||||
|
yyVals[yyTop] = yyVal;
|
||||||
|
//t if (yydebug != null) yydebug.push(yyState, yyVal);
|
||||||
|
|
||||||
|
yyDiscarded: for (;;) { // discarding a token does not change stack
|
||||||
|
int yyN;
|
||||||
|
if ((yyN = YyDefRedClass.yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
if "empty token", get next token */
|
||||||
|
if (yyToken.tokennr <0) {
|
||||||
|
/* modified by diho, 10.04.2004
|
||||||
|
call yyLex.advance in any case, check if yyToken is EOF */
|
||||||
|
yyToken = yyLex.advance(); /*? yyLex.token() : 0;*/
|
||||||
|
/* modified by diho, 27.04.2004
|
||||||
|
if "null", create EOF token */
|
||||||
|
if (yyToken == null) {yyToken = new EOF();}
|
||||||
|
|
||||||
|
//t if (yydebug != null)
|
||||||
|
//t /* modified by diho, 14.04.2004
|
||||||
|
//t orig.: yydebug.lex(yyState, yyToken, yyname(yyToken), yyLex.value()); */
|
||||||
|
//t yydebug.lex(yyState, yyToken.tokennr, yyname(yyToken.tokennr), yyToken.value);
|
||||||
|
}
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyToken by yyToken.tokennr*/
|
||||||
|
if ((yyN = YySindexClass.yySindex[yyState]) != 0 && (yyN += yyToken.tokennr) >= 0
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyToken by yyToken.tokennr*/
|
||||||
|
&& yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken.tokennr) {
|
||||||
|
//t if (yydebug != null)
|
||||||
|
//t yydebug.shift(yyState, YyTableClass.yyTable[yyN], yyErrorFlag-1);
|
||||||
|
yyState = YyTableClass.yyTable[yyN]; // shift to yyN
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyLex.value() by yyToken.value*/
|
||||||
|
yyVal = yyToken.value;
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
orig: yyToken = -1 */
|
||||||
|
yyToken = new yyTokenclass();
|
||||||
|
if (yyErrorFlag > 0) -- yyErrorFlag;
|
||||||
|
continue yyLoop;
|
||||||
|
}
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyToken by yyToken.tokennr*/
|
||||||
|
if ((yyN = YyRindexClass.yyRindex[yyState]) != 0 && (yyN += yyToken.tokennr) >= 0
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyToken by yyToken.tokennr*/
|
||||||
|
&& yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken.tokennr)
|
||||||
|
yyN = YyTableClass.yyTable[yyN]; // reduce (yyN)
|
||||||
|
else
|
||||||
|
switch (yyErrorFlag) {
|
||||||
|
|
||||||
|
case 0:
|
||||||
|
yyerror("syntax error", yyExpecting(yyState));
|
||||||
|
//t if (yydebug != null) yydebug.error("syntax error");
|
||||||
|
|
||||||
|
case 1: case 2:
|
||||||
|
yyErrorFlag = 3;
|
||||||
|
do {
|
||||||
|
if ((yyN = YySindexClass.yySindex[yyStates[yyTop]]) != 0
|
||||||
|
&& (yyN += yyErrorCode) >= 0 && yyN < YyTableClass.yyTable.length
|
||||||
|
&& YyCheckClass.yyCheck[yyN] == yyErrorCode) {
|
||||||
|
//t if (yydebug != null)
|
||||||
|
//t yydebug.shift(yyStates[yyTop], YyTableClass.yyTable[yyN], 3);
|
||||||
|
yyState = YyTableClass.yyTable[yyN];
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyLex.value by yyToken.value*/
|
||||||
|
yyVal = yyToken.value;
|
||||||
|
continue yyLoop;
|
||||||
|
}
|
||||||
|
//t if (yydebug != null) yydebug.pop(yyStates[yyTop]);
|
||||||
|
} while (-- yyTop >= 0);
|
||||||
|
//t if (yydebug != null) yydebug.reject();
|
||||||
|
throw new yyException("irrecoverable syntax error");
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
orig.: if (yyToken == 0)*/
|
||||||
|
if (yyToken == null) {
|
||||||
|
//t if (yydebug != null) yydebug.reject();
|
||||||
|
throw new yyException("irrecoverable syntax error at end-of-file");
|
||||||
|
}
|
||||||
|
//t if (yydebug != null)
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyToken by yyToken.tokennr, yyLex.value by yyToken.value*/
|
||||||
|
//t yydebug.discard(yyState, yyToken.tokennr, yyname(yyToken.tokennr),
|
||||||
|
//t yyToken.value);
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
orig: yyToken = -1*/
|
||||||
|
yyToken = new yyTokenclass();
|
||||||
|
continue yyDiscarded; // leave stack alone
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int yyV = yyTop + 1-YyLenClass.yyLen[yyN];
|
||||||
|
//t if (yydebug != null)
|
||||||
|
//t yydebug.reduce(yyState, yyStates[yyV-1], yyN, YyRuleClass.yyRule[yyN], YyLenClass.yyLen[yyN]);
|
||||||
|
yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
|
||||||
|
switch (yyN) {
|
||||||
|
case 1:
|
||||||
|
// line 14 "browserparser.jay"
|
||||||
|
{}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
// line 15 "browserparser.jay"
|
||||||
|
{}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
// line 16 "browserparser.jay"
|
||||||
|
{}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
// line 17 "browserparser.jay"
|
||||||
|
{}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
// line 18 "browserparser.jay"
|
||||||
|
{}
|
||||||
|
break;
|
||||||
|
// line 286 "-"
|
||||||
|
}
|
||||||
|
yyTop -= YyLenClass.yyLen[yyN];
|
||||||
|
yyState = yyStates[yyTop];
|
||||||
|
int yyM = YyLhsClass.yyLhs[yyN];
|
||||||
|
if (yyState == 0 && yyM == 0) {
|
||||||
|
//t if (yydebug != null) yydebug.shift(0, yyFinal);
|
||||||
|
yyState = yyFinal;
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyToken by yyToken.tokennr*/
|
||||||
|
if (yyToken.tokennr < 0) {
|
||||||
|
/** modified by diho, 10.04.2004
|
||||||
|
*/
|
||||||
|
yyToken = yyLex.advance(); /* ? yyLex.token() : 0;*/
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
if "empty token", get next token */
|
||||||
|
if (yyToken == null) {yyToken = new EOF();}
|
||||||
|
//t if (yydebug != null)
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
replaced yyToken by yyToken.tokennr, yyLex.value() by yyToken.value*/
|
||||||
|
//t yydebug.lex(yyState, yyToken.tokennr,yyname(yyToken.tokennr), yyToken.value);
|
||||||
|
}
|
||||||
|
/* modified by diho, 14.04.2004
|
||||||
|
orig.: if (yyToken == 0) */
|
||||||
|
if (yyToken.tokennr == 0) {
|
||||||
|
//t if (yydebug != null) yydebug.accept(yyVal);
|
||||||
|
return yyVal;
|
||||||
|
}
|
||||||
|
continue yyLoop;
|
||||||
|
}
|
||||||
|
if ((yyN = YyGindexClass.yyGindex[yyM]) != 0 && (yyN += yyState) >= 0
|
||||||
|
&& yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyState)
|
||||||
|
yyState = YyTableClass.yyTable[yyN];
|
||||||
|
else
|
||||||
|
yyState = YyDgotoClass.yyDgoto[yyM];
|
||||||
|
//t if (yydebug != null) yydebug.shift(yyStates[yyTop], yyState);
|
||||||
|
continue yyLoop;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static final class YyLhsClass {
|
||||||
|
|
||||||
|
public static final short yyLhs [] = { -1,
|
||||||
|
0, 1, 1, 1, 1,
|
||||||
|
};
|
||||||
|
} /* End of class YyLhsClass */
|
||||||
|
|
||||||
|
protected static final class YyLenClass {
|
||||||
|
|
||||||
|
public static final short yyLen [] = { 2,
|
||||||
|
5, 1, 1, 1, 1,
|
||||||
|
};
|
||||||
|
} /* End class YyLenClass */
|
||||||
|
|
||||||
|
protected static final class YyDefRedClass {
|
||||||
|
|
||||||
|
public static final short yyDefRed [] = { 0,
|
||||||
|
0, 0, 0, 2, 3, 4, 5, 0, 0, 1,
|
||||||
|
};
|
||||||
|
} /* End of class YyDefRedClass */
|
||||||
|
|
||||||
|
protected static final class YyDgotoClass {
|
||||||
|
|
||||||
|
public static final short yyDgoto [] = { 2,
|
||||||
|
8,
|
||||||
|
};
|
||||||
|
} /* End of class YyDgotoClass */
|
||||||
|
|
||||||
|
protected static final class YySindexClass {
|
||||||
|
|
||||||
|
public static final short yySindex [] = { -254,
|
||||||
|
-255, 0, -261, 0, 0, 0, 0, -253, -251, 0,
|
||||||
|
};
|
||||||
|
} /* End of class YySindexClass */
|
||||||
|
|
||||||
|
protected static final class YyRindexClass {
|
||||||
|
|
||||||
|
public static final short yyRindex [] = { 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
};
|
||||||
|
} /* End of class YyRindexClass */
|
||||||
|
|
||||||
|
protected static final class YyGindexClass {
|
||||||
|
|
||||||
|
public static final short yyGindex [] = { 0,
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
} /* End of class YyGindexClass */
|
||||||
|
|
||||||
|
protected static class yyTable0 {
|
||||||
|
protected static final short yyTable0 [] = { 4,
|
||||||
|
5, 6, 7, 1, 3, 0, 9, 10,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected static final class YyTableClass {
|
||||||
|
|
||||||
|
static short[] yyTable = new short[9];
|
||||||
|
protected static void yyTableInit () {
|
||||||
|
int numyycheck;
|
||||||
|
int yyTableerun = 0;
|
||||||
|
for (numyycheck = 0; numyycheck <= 1000; numyycheck++) {
|
||||||
|
if (yyTableerun < 9) {
|
||||||
|
yyTable[yyTableerun] = yyTable0.yyTable0[numyycheck];
|
||||||
|
yyTableerun++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /* End of class YyTableClass */
|
||||||
|
|
||||||
|
protected static class yyCheck0 {
|
||||||
|
protected static final short yyCheck0 [] = { 261,
|
||||||
|
262, 263, 264, 258, 260, -1, 260, 259,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
protected static final class YyCheckClass {
|
||||||
|
|
||||||
|
static short[] yyCheck = new short[9];
|
||||||
|
protected static void yyCheckInit () {
|
||||||
|
int numyycheck;
|
||||||
|
int yyCheckerun = 0;
|
||||||
|
for (numyycheck = 0; numyycheck <= 1000; numyycheck++) {
|
||||||
|
if (yyCheckerun < 9) {
|
||||||
|
yyCheck[yyCheckerun] = yyCheck0.yyCheck0[numyycheck];
|
||||||
|
yyCheckerun++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
} /* End of class YyCheckClass */
|
||||||
|
|
||||||
|
|
||||||
|
//t protected static final class YyRuleClass {
|
||||||
|
|
||||||
|
//t public static final String yyRule [] = {
|
||||||
|
//t "$accept : S",
|
||||||
|
//t "S : AUFKLAMMER NUM OPERATION NUM ZUKLAMMER",
|
||||||
|
//t "OPERATION : ADDITION",
|
||||||
|
//t "OPERATION : SUBTRA",
|
||||||
|
//t "OPERATION : MULTI",
|
||||||
|
//t "OPERATION : DIV",
|
||||||
|
//t };
|
||||||
|
//t } /* End of class YyRuleClass */
|
||||||
|
|
||||||
|
protected static final class YyNameClass {
|
||||||
|
|
||||||
|
public static final String yyName [] = {
|
||||||
|
"end-of-file",null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,null,null,null,null,null,null,null,
|
||||||
|
null,null,null,null,null,null,null,"WS","AUFKLAMMER","ZUKLAMMER",
|
||||||
|
"NUM","ADDITION","SUBTRA","MULTI","DIV",
|
||||||
|
};
|
||||||
|
} /* End of class YyNameClass */
|
||||||
|
|
||||||
|
|
||||||
|
// line 20 "browserparser.jay"
|
||||||
|
}
|
||||||
|
// line 468 "-"
|
||||||
|
class yyTokenclass {
|
||||||
|
public int tokennr;
|
||||||
|
public Object value;
|
||||||
|
|
||||||
|
yyTokenclass () {
|
||||||
|
this.tokennr=-1;
|
||||||
|
}
|
||||||
|
yyTokenclass (Object o) {
|
||||||
|
this.value = o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class EOF extends yyTokenclass {
|
||||||
|
|
||||||
|
EOF () {
|
||||||
|
super();
|
||||||
|
this.tokennr=0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// %token constants
|
||||||
|
|
||||||
|
final class WS extends yyTokenclass {
|
||||||
|
WS(Object o) {
|
||||||
|
super(o);
|
||||||
|
this.tokennr = 257;
|
||||||
|
}
|
||||||
|
WS() {
|
||||||
|
super();
|
||||||
|
this.tokennr = 257;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final class AUFKLAMMER extends yyTokenclass {
|
||||||
|
AUFKLAMMER(Object o) {
|
||||||
|
super(o);
|
||||||
|
this.tokennr = 258;
|
||||||
|
}
|
||||||
|
AUFKLAMMER() {
|
||||||
|
super();
|
||||||
|
this.tokennr = 258;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final class ZUKLAMMER extends yyTokenclass {
|
||||||
|
ZUKLAMMER(Object o) {
|
||||||
|
super(o);
|
||||||
|
this.tokennr = 259;
|
||||||
|
}
|
||||||
|
ZUKLAMMER() {
|
||||||
|
super();
|
||||||
|
this.tokennr = 259;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final class NUM extends yyTokenclass {
|
||||||
|
NUM(Object o) {
|
||||||
|
super(o);
|
||||||
|
this.tokennr = 260;
|
||||||
|
}
|
||||||
|
NUM() {
|
||||||
|
super();
|
||||||
|
this.tokennr = 260;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final class ADDITION extends yyTokenclass {
|
||||||
|
ADDITION(Object o) {
|
||||||
|
super(o);
|
||||||
|
this.tokennr = 261;
|
||||||
|
}
|
||||||
|
ADDITION() {
|
||||||
|
super();
|
||||||
|
this.tokennr = 261;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final class SUBTRA extends yyTokenclass {
|
||||||
|
SUBTRA(Object o) {
|
||||||
|
super(o);
|
||||||
|
this.tokennr = 262;
|
||||||
|
}
|
||||||
|
SUBTRA() {
|
||||||
|
super();
|
||||||
|
this.tokennr = 262;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final class MULTI extends yyTokenclass {
|
||||||
|
MULTI(Object o) {
|
||||||
|
super(o);
|
||||||
|
this.tokennr = 263;
|
||||||
|
}
|
||||||
|
MULTI() {
|
||||||
|
super();
|
||||||
|
this.tokennr = 263;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final class DIV extends yyTokenclass {
|
||||||
|
DIV(Object o) {
|
||||||
|
super(o);
|
||||||
|
this.tokennr = 264;
|
||||||
|
}
|
||||||
|
DIV() {
|
||||||
|
super();
|
||||||
|
this.tokennr = 264;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
final class yyError extends yyTokenclass {
|
||||||
|
yyError () {
|
||||||
|
super();
|
||||||
|
this.tokennr = 256;
|
||||||
|
}
|
||||||
|
}
|
20
browserparser.jay
Normal file
20
browserparser.jay
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
%{
|
||||||
|
class browserparser { %}
|
||||||
|
|
||||||
|
%token WS
|
||||||
|
%token AUFKLAMMER
|
||||||
|
%token ZUKLAMMER
|
||||||
|
%token NUM
|
||||||
|
%token ADDITION
|
||||||
|
%token SUBTRA
|
||||||
|
%token MULTI
|
||||||
|
%token DIV
|
||||||
|
|
||||||
|
%%
|
||||||
|
S: AUFKLAMMER NUM OPERATION NUM ZUKLAMMER {}
|
||||||
|
OPERATION: ADDITION {}
|
||||||
|
OPERATION: SUBTRA {}
|
||||||
|
OPERATION: MULTI {}
|
||||||
|
OPERATION: DIV {}
|
||||||
|
%%
|
||||||
|
}
|
BIN
browserscanner.class
Normal file
BIN
browserscanner.class
Normal file
Binary file not shown.
14
fst.html
Executable file
14
fst.html
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Titel</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Ueberschrift 1</h1>
|
||||||
|
<h2>Ueberschrift 2</h2>
|
||||||
|
<b>
|
||||||
|
Boldtest
|
||||||
|
</b>
|
||||||
|
<p>sd
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
350
skeleton.jaooy
Normal file
350
skeleton.jaooy
Normal file
@ -0,0 +1,350 @@
|
|||||||
|
# jay skeleton
|
||||||
|
|
||||||
|
# character in column 1 determines outcome...
|
||||||
|
# # is a comment
|
||||||
|
# . is copied
|
||||||
|
# t is copied as //t if -t is set
|
||||||
|
# other lines are interpreted to call jay procedures
|
||||||
|
|
||||||
|
.// created by jay 0.8 (c) 1998 Axel.Schreiner@informatik.uni-osnabrueck.de
|
||||||
|
.
|
||||||
|
|
||||||
|
prolog ## %{ ... %} prior to the first %%
|
||||||
|
|
||||||
|
. yyError yytemperror = new yyError();
|
||||||
|
. public final int yyErrorCode = yytemperror.tokennr;
|
||||||
|
.
|
||||||
|
. /** thrown for irrecoverable syntax errors and stack overflow.
|
||||||
|
. */
|
||||||
|
. public static class yyException extends java.lang.Exception {
|
||||||
|
. public yyException (String message) {
|
||||||
|
. super(message);
|
||||||
|
. }
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
. /** must be implemented by a scanner object to supply input to the parser.
|
||||||
|
. */
|
||||||
|
. public interface yyInput {
|
||||||
|
. /** move on to next token.
|
||||||
|
. @return false if positioned beyond tokens.
|
||||||
|
. @throws IOException on input error.
|
||||||
|
. */
|
||||||
|
. /** modified by diho, 10.04.2004 */
|
||||||
|
. yyTokenclass advance () throws java.io.IOException;
|
||||||
|
. /** classifies current token.
|
||||||
|
. Should not be called if advance() returned false.
|
||||||
|
. @return current %token or single character.
|
||||||
|
. */
|
||||||
|
. /** modified by diho, 10.04.2004 token () is not longer necessary,
|
||||||
|
. advance () supplies token or null
|
||||||
|
. int token (); */
|
||||||
|
.
|
||||||
|
.
|
||||||
|
. /** associated with current token.
|
||||||
|
. Should not be called if advance() returned false.
|
||||||
|
. @return value for token().
|
||||||
|
. */
|
||||||
|
. /** modified by diho, 10.04.2004 value () is not longer necessary,
|
||||||
|
. Token value can be retrieved from Token itself.
|
||||||
|
. Object value ();*/
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
. /** simplified error message.
|
||||||
|
. @see <a href="#yyerror(java.lang.String, java.lang.String[])">yyerror</a>
|
||||||
|
. */
|
||||||
|
. public void yyerror (String message) {
|
||||||
|
. yyerror(message, null);
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
. /** (syntax) error message.
|
||||||
|
. Can be overwritten to control message format.
|
||||||
|
. @param message text to be displayed.
|
||||||
|
. @param expected vector of acceptable tokens, if available.
|
||||||
|
. */
|
||||||
|
. public void yyerror (String message, String[] expected) {
|
||||||
|
. if (expected != null && expected.length > 0) {
|
||||||
|
. System.err.print(message+", expecting");
|
||||||
|
. for (int n = 0; n < expected.length; ++ n)
|
||||||
|
. System.err.print(" "+expected[n]);
|
||||||
|
. System.err.println();
|
||||||
|
. } else
|
||||||
|
. System.err.println(message);
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
. /** debugging support, requires the package jay.yydebug.
|
||||||
|
. Set to null to suppress debugging messages.
|
||||||
|
. */
|
||||||
|
t protected jay.yydebug.yyDebug yydebug;
|
||||||
|
.
|
||||||
|
final_rule ## constant storing final rule
|
||||||
|
.
|
||||||
|
. /** index-checked interface to yyName[].
|
||||||
|
. @param token single character or %token value.
|
||||||
|
. @return token name or [illegal] or [unknown].
|
||||||
|
. */
|
||||||
|
t public static final String yyname (int token) {
|
||||||
|
t if (token < 0 || token > YyNameClass.yyName.length) return "[illegal]";
|
||||||
|
t String name;
|
||||||
|
t if ((name = YyNameClass.yyName[token]) != null) return name;
|
||||||
|
t return "[unknown]";
|
||||||
|
t }
|
||||||
|
.
|
||||||
|
. /** computes list of expected tokens on error by tracing the tables.
|
||||||
|
. @param state for which to compute the list.
|
||||||
|
. @return list of token names.
|
||||||
|
. */
|
||||||
|
. protected String[] yyExpecting (int state) {
|
||||||
|
. int token, n, len = 0;
|
||||||
|
. boolean[] ok = new boolean[YyNameClass.yyName.length];
|
||||||
|
.
|
||||||
|
. if ((n = YySindexClass.yySindex[state]) != 0)
|
||||||
|
. for (token = n < 0 ? -n : 0;
|
||||||
|
. token < YyNameClass.yyName.length && n+token < YyTableClass.yyTable.length; ++ token)
|
||||||
|
. if (YyCheckClass.yyCheck[n+token] == token && !ok[token] && YyNameClass.yyName[token] != null) {
|
||||||
|
. ++ len;
|
||||||
|
. ok[token] = true;
|
||||||
|
. }
|
||||||
|
. if ((n = YyRindexClass.yyRindex[state]) != 0)
|
||||||
|
. for (token = n < 0 ? -n : 0;
|
||||||
|
. token < YyNameClass.yyName.length && n+token < YyTableClass.yyTable.length; ++ token)
|
||||||
|
. if (YyCheckClass.yyCheck[n+token] == token && !ok[token] && YyNameClass.yyName[token] != null) {
|
||||||
|
. ++ len;
|
||||||
|
. ok[token] = true;
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
. String result[] = new String[len];
|
||||||
|
. for (n = token = 0; n < len; ++ token)
|
||||||
|
. if (ok[token]) result[n++] = YyNameClass.yyName[token];
|
||||||
|
. return result;
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
. /** the generated parser, with debugging messages.
|
||||||
|
. Maintains a state and a value stack, currently with fixed maximum size.
|
||||||
|
. @param yyLex scanner.
|
||||||
|
. @param yydebug debug message writer implementing yyDebug, or null.
|
||||||
|
. @return result of the last reduction, if any.
|
||||||
|
. @throws yyException on irrecoverable parse error.
|
||||||
|
. */
|
||||||
|
. public Object yyparse (yyInput yyLex, Object yydebug)
|
||||||
|
. throws java.io.IOException, yyException {
|
||||||
|
t this.yydebug = (jay.yydebug.yyDebug)yydebug;
|
||||||
|
. return yyparse(yyLex);
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
. /** initial size and increment of the state/value stack [default 256].
|
||||||
|
. This is not final so that it can be overwritten outside of invocations
|
||||||
|
. of yyparse().
|
||||||
|
. */
|
||||||
|
. protected int yyMax;
|
||||||
|
.
|
||||||
|
. /** executed at the beginning of a reduce action.
|
||||||
|
. Used as $$ = yyDefault($1), prior to the user-specified action, if any.
|
||||||
|
. Can be overwritten to provide deep copy, etc.
|
||||||
|
. @param first value for $1, or null.
|
||||||
|
. @return first.
|
||||||
|
. */
|
||||||
|
. protected Object yyDefault (Object first) {
|
||||||
|
. return first;
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
. /** the generated parser.
|
||||||
|
. Maintains a state and a value stack, currently with fixed maximum size.
|
||||||
|
. @param yyLex scanner.
|
||||||
|
. @return result of the last reduction, if any.
|
||||||
|
. @throws yyException on irrecoverable parse error.
|
||||||
|
. */
|
||||||
|
. public Object yyparse (yyInput yyLex)
|
||||||
|
. throws java.io.IOException, yyException {
|
||||||
|
. YyCheckClass.yyCheckInit(); // initial yyCheck eingefuegt PL 05-03-08
|
||||||
|
. YyTableClass.yyTableInit(); // initial yyCheck eingefuegt PL 05-03-08
|
||||||
|
. if (yyMax <= 0) yyMax = 256; // initial size
|
||||||
|
. int yyState = 0, yyStates[] = new int[yyMax]; // state stack
|
||||||
|
. Object yyVal = null, yyVals[] = new Object[yyMax]; // value stack
|
||||||
|
. /*modified by diho, 14.04.2004
|
||||||
|
. orig: int yyToken = -1 was replaced by "empty Token"*/
|
||||||
|
. yyTokenclass yyToken = new yyTokenclass(); // current input
|
||||||
|
. int yyErrorFlag = 0; // #tks to shift
|
||||||
|
.
|
||||||
|
local ## %{ ... %} after the first %%
|
||||||
|
|
||||||
|
. yyLoop: for (int yyTop = 0;; ++ yyTop) {
|
||||||
|
. if (yyTop >= yyStates.length) { // dynamically increase
|
||||||
|
. int[] i = new int[yyStates.length+yyMax];
|
||||||
|
. System.arraycopy(yyStates, 0, i, 0, yyStates.length);
|
||||||
|
. yyStates = i;
|
||||||
|
. Object[] o = new Object[yyVals.length+yyMax];
|
||||||
|
. System.arraycopy(yyVals, 0, o, 0, yyVals.length);
|
||||||
|
. yyVals = o;
|
||||||
|
. }
|
||||||
|
. yyStates[yyTop] = yyState;
|
||||||
|
. yyVals[yyTop] = yyVal;
|
||||||
|
t if (yydebug != null) yydebug.push(yyState, yyVal);
|
||||||
|
.
|
||||||
|
. yyDiscarded: for (;;) { // discarding a token does not change stack
|
||||||
|
. int yyN;
|
||||||
|
. if ((yyN = YyDefRedClass.yyDefRed[yyState]) == 0) { // else [default] reduce (yyN)
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. if "empty token", get next token */
|
||||||
|
. if (yyToken.tokennr <0) {
|
||||||
|
. /* modified by diho, 10.04.2004
|
||||||
|
. call yyLex.advance in any case, check if yyToken is EOF */
|
||||||
|
. yyToken = yyLex.advance(); /*? yyLex.token() : 0;*/
|
||||||
|
. /* modified by diho, 27.04.2004
|
||||||
|
. if "null", create EOF token */
|
||||||
|
. if (yyToken == null) {yyToken = new EOF();}
|
||||||
|
.
|
||||||
|
t if (yydebug != null)
|
||||||
|
t /* modified by diho, 14.04.2004
|
||||||
|
t orig.: yydebug.lex(yyState, yyToken, yyname(yyToken), yyLex.value()); */
|
||||||
|
t yydebug.lex(yyState, yyToken.tokennr, yyname(yyToken.tokennr), yyToken.value);
|
||||||
|
. }
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyToken by yyToken.tokennr*/
|
||||||
|
. if ((yyN = YySindexClass.yySindex[yyState]) != 0 && (yyN += yyToken.tokennr) >= 0
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyToken by yyToken.tokennr*/
|
||||||
|
. && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken.tokennr) {
|
||||||
|
t if (yydebug != null)
|
||||||
|
t yydebug.shift(yyState, YyTableClass.yyTable[yyN], yyErrorFlag-1);
|
||||||
|
. yyState = YyTableClass.yyTable[yyN]; // shift to yyN
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyLex.value() by yyToken.value*/
|
||||||
|
. yyVal = yyToken.value;
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. orig: yyToken = -1 */
|
||||||
|
. yyToken = new yyTokenclass();
|
||||||
|
. if (yyErrorFlag > 0) -- yyErrorFlag;
|
||||||
|
. continue yyLoop;
|
||||||
|
. }
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyToken by yyToken.tokennr*/
|
||||||
|
. if ((yyN = YyRindexClass.yyRindex[yyState]) != 0 && (yyN += yyToken.tokennr) >= 0
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyToken by yyToken.tokennr*/
|
||||||
|
. && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyToken.tokennr)
|
||||||
|
. yyN = YyTableClass.yyTable[yyN]; // reduce (yyN)
|
||||||
|
. else
|
||||||
|
. switch (yyErrorFlag) {
|
||||||
|
.
|
||||||
|
. case 0:
|
||||||
|
. yyerror("syntax error", yyExpecting(yyState));
|
||||||
|
t if (yydebug != null) yydebug.error("syntax error");
|
||||||
|
.
|
||||||
|
. case 1: case 2:
|
||||||
|
. yyErrorFlag = 3;
|
||||||
|
. do {
|
||||||
|
. if ((yyN = YySindexClass.yySindex[yyStates[yyTop]]) != 0
|
||||||
|
. && (yyN += yyErrorCode) >= 0 && yyN < YyTableClass.yyTable.length
|
||||||
|
. && YyCheckClass.yyCheck[yyN] == yyErrorCode) {
|
||||||
|
t if (yydebug != null)
|
||||||
|
t yydebug.shift(yyStates[yyTop], YyTableClass.yyTable[yyN], 3);
|
||||||
|
. yyState = YyTableClass.yyTable[yyN];
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyLex.value by yyToken.value*/
|
||||||
|
. yyVal = yyToken.value;
|
||||||
|
. continue yyLoop;
|
||||||
|
. }
|
||||||
|
t if (yydebug != null) yydebug.pop(yyStates[yyTop]);
|
||||||
|
. } while (-- yyTop >= 0);
|
||||||
|
t if (yydebug != null) yydebug.reject();
|
||||||
|
. throw new yyException("irrecoverable syntax error");
|
||||||
|
.
|
||||||
|
. case 3:
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. orig.: if (yyToken == 0)*/
|
||||||
|
. if (yyToken == null) {
|
||||||
|
t if (yydebug != null) yydebug.reject();
|
||||||
|
. throw new yyException("irrecoverable syntax error at end-of-file");
|
||||||
|
. }
|
||||||
|
t if (yydebug != null)
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyToken by yyToken.tokennr, yyLex.value by yyToken.value*/
|
||||||
|
t yydebug.discard(yyState, yyToken.tokennr, yyname(yyToken.tokennr),
|
||||||
|
t yyToken.value);
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. orig: yyToken = -1*/
|
||||||
|
. yyToken = new yyTokenclass();
|
||||||
|
. continue yyDiscarded; // leave stack alone
|
||||||
|
. }
|
||||||
|
. }
|
||||||
|
. int yyV = yyTop + 1-YyLenClass.yyLen[yyN];
|
||||||
|
t if (yydebug != null)
|
||||||
|
t yydebug.reduce(yyState, yyStates[yyV-1], yyN, YyRuleClass.yyRule[yyN], YyLenClass.yyLen[yyN]);
|
||||||
|
. yyVal = yyDefault(yyV > yyTop ? null : yyVals[yyV]);
|
||||||
|
. switch (yyN) {
|
||||||
|
|
||||||
|
actions ## code from the actions within the grammar
|
||||||
|
|
||||||
|
. }
|
||||||
|
. yyTop -= YyLenClass.yyLen[yyN];
|
||||||
|
. yyState = yyStates[yyTop];
|
||||||
|
. int yyM = YyLhsClass.yyLhs[yyN];
|
||||||
|
. if (yyState == 0 && yyM == 0) {
|
||||||
|
t if (yydebug != null) yydebug.shift(0, yyFinal);
|
||||||
|
. yyState = yyFinal;
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyToken by yyToken.tokennr*/
|
||||||
|
. if (yyToken.tokennr < 0) {
|
||||||
|
. /** modified by diho, 10.04.2004
|
||||||
|
. */
|
||||||
|
. yyToken = yyLex.advance(); /* ? yyLex.token() : 0;*/
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. if "empty token", get next token */
|
||||||
|
. if (yyToken == null) {yyToken = new EOF();}
|
||||||
|
t if (yydebug != null)
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. replaced yyToken by yyToken.tokennr, yyLex.value() by yyToken.value*/
|
||||||
|
t yydebug.lex(yyState, yyToken.tokennr,yyname(yyToken.tokennr), yyToken.value);
|
||||||
|
. }
|
||||||
|
. /* modified by diho, 14.04.2004
|
||||||
|
. orig.: if (yyToken == 0) */
|
||||||
|
. if (yyToken.tokennr == 0) {
|
||||||
|
t if (yydebug != null) yydebug.accept(yyVal);
|
||||||
|
. return yyVal;
|
||||||
|
. }
|
||||||
|
. continue yyLoop;
|
||||||
|
. }
|
||||||
|
. if ((yyN = YyGindexClass.yyGindex[yyM]) != 0 && (yyN += yyState) >= 0
|
||||||
|
. && yyN < YyTableClass.yyTable.length && YyCheckClass.yyCheck[yyN] == yyState)
|
||||||
|
. yyState = YyTableClass.yyTable[yyN];
|
||||||
|
. else
|
||||||
|
. yyState = YyDgotoClass.yyDgoto[yyM];
|
||||||
|
t if (yydebug != null) yydebug.shift(yyStates[yyTop], yyState);
|
||||||
|
. continue yyLoop;
|
||||||
|
. }
|
||||||
|
. }
|
||||||
|
. }
|
||||||
|
.
|
||||||
|
tables ## tables for rules, default reduction, and action calls
|
||||||
|
.
|
||||||
|
debug ## tables for debugging support
|
||||||
|
.
|
||||||
|
epilog ## text following second %%
|
||||||
|
|
||||||
|
# modified by diho, 11.02.2004
|
||||||
|
.class yyTokenclass {
|
||||||
|
. public int tokennr;
|
||||||
|
. public Object value;
|
||||||
|
.
|
||||||
|
. yyTokenclass () {
|
||||||
|
. this.tokennr=-1;
|
||||||
|
. }
|
||||||
|
. yyTokenclass (Object o) {
|
||||||
|
. this.value = o;
|
||||||
|
. }
|
||||||
|
.}
|
||||||
|
.class EOF extends yyTokenclass {
|
||||||
|
.
|
||||||
|
. EOF () {
|
||||||
|
. super();
|
||||||
|
. this.tokennr=0;
|
||||||
|
. }
|
||||||
|
.}
|
||||||
|
|
||||||
|
|
||||||
|
# end of modification
|
||||||
|
.// %token constants
|
||||||
|
.
|
||||||
|
# modified by diho, 11.02.2004
|
||||||
|
tokens final class
|
||||||
|
# end of modification
|
89
y.output
Normal file
89
y.output
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
0 $accept : S $end
|
||||||
|
|
||||||
|
1 S : AUFKLAMMER NUM OPERATION NUM ZUKLAMMER
|
||||||
|
|
||||||
|
2 OPERATION : ADDITION
|
||||||
|
3 | SUBTRA
|
||||||
|
4 | MULTI
|
||||||
|
5 | DIV
|
||||||
|
|
||||||
|
state 0
|
||||||
|
$accept : . S $end (0)
|
||||||
|
|
||||||
|
AUFKLAMMER shift 1
|
||||||
|
. error
|
||||||
|
|
||||||
|
S goto 2
|
||||||
|
|
||||||
|
|
||||||
|
state 1
|
||||||
|
S : AUFKLAMMER . NUM OPERATION NUM ZUKLAMMER (1)
|
||||||
|
|
||||||
|
NUM shift 3
|
||||||
|
. error
|
||||||
|
|
||||||
|
|
||||||
|
state 2
|
||||||
|
$accept : S . $end (0)
|
||||||
|
|
||||||
|
$end accept
|
||||||
|
|
||||||
|
|
||||||
|
state 3
|
||||||
|
S : AUFKLAMMER NUM . OPERATION NUM ZUKLAMMER (1)
|
||||||
|
|
||||||
|
ADDITION shift 4
|
||||||
|
SUBTRA shift 5
|
||||||
|
MULTI shift 6
|
||||||
|
DIV shift 7
|
||||||
|
. error
|
||||||
|
|
||||||
|
OPERATION goto 8
|
||||||
|
|
||||||
|
|
||||||
|
state 4
|
||||||
|
OPERATION : ADDITION . (2)
|
||||||
|
|
||||||
|
. reduce 2
|
||||||
|
|
||||||
|
|
||||||
|
state 5
|
||||||
|
OPERATION : SUBTRA . (3)
|
||||||
|
|
||||||
|
. reduce 3
|
||||||
|
|
||||||
|
|
||||||
|
state 6
|
||||||
|
OPERATION : MULTI . (4)
|
||||||
|
|
||||||
|
. reduce 4
|
||||||
|
|
||||||
|
|
||||||
|
state 7
|
||||||
|
OPERATION : DIV . (5)
|
||||||
|
|
||||||
|
. reduce 5
|
||||||
|
|
||||||
|
|
||||||
|
state 8
|
||||||
|
S : AUFKLAMMER NUM OPERATION . NUM ZUKLAMMER (1)
|
||||||
|
|
||||||
|
NUM shift 9
|
||||||
|
. error
|
||||||
|
|
||||||
|
|
||||||
|
state 9
|
||||||
|
S : AUFKLAMMER NUM OPERATION NUM . ZUKLAMMER (1)
|
||||||
|
|
||||||
|
ZUKLAMMER shift 10
|
||||||
|
. error
|
||||||
|
|
||||||
|
|
||||||
|
state 10
|
||||||
|
S : AUFKLAMMER NUM OPERATION NUM ZUKLAMMER . (1)
|
||||||
|
|
||||||
|
. reduce 1
|
||||||
|
|
||||||
|
|
||||||
|
10 terminals, 3 nonterminals
|
||||||
|
6 grammar rules, 11 states
|
BIN
yyError.class
Normal file
BIN
yyError.class
Normal file
Binary file not shown.
BIN
yyTokenclass.class
Normal file
BIN
yyTokenclass.class
Normal file
Binary file not shown.
BIN
yydebug.jar
Normal file
BIN
yydebug.jar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user