I've implemented it before in flex+cup, but SableCC make things cleaner so I'm rewriting my work. For the lexer I went for a weird subclassing to the Lexer class and overriding of the filter() method to implement a state machine over what SableCC detects and get some of the required features (error detection).
Now with the parser I get this conflict that (I guess) is very basic, but I can't think of a way to overcome it.
t =
{mult} t mult f
| {other} f
;
f =
{bool} int_const
| {let} let t
;
I'm oversimplifying it a lot but you get the idea, the "let" structure is more complex but it has to end with t (in the full grammar it is all the tree of expressions). This is an obvious shift/reduce as with:
let 5 | * let 6
The grammar is not specifying whether to reduce on "let 5" or shift the operator to continue parsing. I'm basically looking for a pattern to give shift a precedence. In cup you have an explicit operator to do that, but is there a way to rewrite this grammar to do the same? I also know that modifying the let to have a terminator would do the trick, but I don't want to modify the syntax.
Thank you!
Abdul