eliminate the choice conflict.
Choice conflict in [...] construct at line 298, column 5.
Expansion nested within construct and expansion following construct
have common prefixes, one of which is: "."
Consider using a lookahead of 2 or more for nested expansion.
This Grammar:
Factor -> ('-'|'!') Factor
| Lvalue ['.' "length" '(' ')' | '(' [Args] ')']
| '(' Expr ')'
| Literal
Lvalue -> ["this" '.']
Had to be expanded to :
Exp Factor(): {}
{
("-"|"!") Factor()
| Lvalue() ["." "length" "(" ")" | "(" [Args()] ")"]
| "(" Expr() ")"
| Literal()
}
//Lvalue -> ["this" '.']
Exp Lvalue(): {}
{
["this" "."]
[ LOOKAHEAD(2) LvalueLower()]
}
// LvalueLower -> '[' Expr ']' | '.'
void LvalueLower():{}
{
"."
}
https://bitbucket.org/aaron_skomra/minijava2/src/af557e14135e/proj3/parser/miniParser.jj
No comments:
Post a Comment