List Info

Thread: "ocaml_beginners"::[] Re: ocamllex - return 2 tokens on eof?




"ocaml_beginners"::[] Re: ocamllex - return 2 tokens on eof?
country flaguser name
United States
2007-02-28 11:48:33

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_beginnersyahoogroups.com, Mathias Kende <mathias...> wrote:
&gt;
> You may use something like :
>
> main:
&gt; stmtlist EOF
> |stmtlist stmt2 EOF
>
> and just define stmt2 without an ENDTAG token.
> This is not much to write and should be enough.
>
>

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )