I tried this, but without success. I get many (567) shift/reduce
conflicts and many (54) reduce/reduce conflicts, and the same error
message comes up.
I defined stmt2 by copying all the rules for stmt and, if the rule
ends with stmt_end, I remove the stmt_end symbol, and if it does not,
I remove the rule.
Probably part of the reason for the many conflicts is that there are
rules like:
stmt:
(* lots of rules *)
| WHILE LPAREN exp RPAREN stmt
So I add in new rules like.
| WHILE LPAREN exp RPAREN stmt2
I may be able to rewrite the grammar to get rid of the conflicts, but
I'd rather not risk introducing unintended changes. I would really
like to do something more like having the lexer return two tokens on
EOF (as I mentioned in my previous post). Any ideas?
--Gary
--- In ocaml_beginners%40yahoogroups.com">ocaml_beginners
yahoogroups.com, Mathias Kende <mathias
...> wrote:
>
> You may use something like :
>
> main:
> stmtlist EOF
> |stmtlist stmt2 EOF
>
> and just define stmt2 without an ENDTAG token.
> This is not much to write and should be enough.
>
>
.