Reputation: 221
I'm doing an assignment on Compilers for my university, and I am using SableCC 3.7 for the first time. I am trying to define my grammar file, but when I try to run it (via command line) I get this error:
"ParserException: [51,5] expecting: EOF
Helpers
letter = ['a' .. 'z'];
digit = ['0' .. '9'];
plus = '+';
minus = '-';
mult = '*';
div = '/';
star = '*';
equals = '=';
leftbrack = '(';
rightbrack = ')';
leftcurly = '{';
rightcurly = '{';
tab = 9;
cr = 13;
space = 32;
nl = 10;
eol = cr nl | cr | nl |;
func = 'func';
identifier = (letter|'_')(letter|'_'|digit)*;
float = minus ? digit ( digit ) * '.' digit ( digit ) * ( ( 'E' | 'e' ) ( '+' | '-' ) ? digit ( digit ) * ) ?;
combination = (tab|cr|eol|space|nl)+;
line_comment ='/''/'[[ 0 .. 0xffff]-[cr+nl]]*eol|';'[[0..0xffff]-[cr+nl]]*eol;
multiline_comment ='/''*'[[0..0xffff]-['*'+'/']]*'*''/';
Tokens
func = 'FUNC';
plus = plus;
minus = minus;
mult = mult;
div = div;
equals = equals;
leftbrack = leftbrack;
rightbrack = rightbrack;
leftcurly = leftcurly;
rightcurly = rightcurly;
identifier = ('ID,')(identifier);
float = ('ID,')(float);
number = digit+;
line_comment = 'COMMENT';
multiline_comment = 'COMMENT';
combination = 'WHITESPACE';
Ignored Tokens
line_comment;
multiline_comment;
Does anyone know how to solve this? The documentation online is not the best.
Upvotes: 0
Views: 1214
Reputation: 373
Probably this:
Ignored Tokens
line_comment,
multiline_comment;
You have to separate the Ignored Tokens
by comma and not semicolon.
Upvotes: 1