From: "Yann Régis-Gianas" <yann.regisgianas@gmail.com>
To: "David Allsopp" <dra-news@metastack.com>
Cc: "OCaml List" <caml-list@yquem.inria.fr>
Subject: Re: [Caml-list] Fairly dumb ocamlyacc question
Date: Tue, 24 Oct 2006 23:40:43 +0200 [thread overview]
Message-ID: <1af89fca0610241440j202e9c43m3025d2395b456f34@mail.gmail.com> (raw)
In-Reply-To: <003401c6f7b0$01f9ca10$5a878640@countertenor>
Hello,
Have you tried menhir :
http://pauillac.inria.fr/~fpottier/menhir/menhir.html.en ?
Menhir generates an explanation of your conflicts and is 90%
compatible with ocamlyacc.
Hope this helps,
--
Yann R.-G.
On 10/24/06, David Allsopp <dra-news@metastack.com> wrote:
> This should be obvious, but I can't quite solve it!
>
> If I use the following ocamlyacc script:
>
> ------------
> %token BEFORE_KWD AFTER_KWD
> %token FAILS_KWD
>
> %token <int> WEEKDAY
> %token <string> NAME
>
> %type <unit> top
> %start top
> %%
>
> top:
> WEEKDAY AFTER_KWD NAME BEFORE_KWD NAME FAILS_KWD top {()}
> | WEEKDAY relative NAME {()}
> ;
>
> relative:
> BEFORE_KWD {()}
> | AFTER_KWD {()}
> ;
> ------------
>
> Then I get a shift/reduce having parsed WEEKDAY AFTER_KWD... the parser
> can't figure out what to do if it sees NAME. This problem can be made to
> disappear by expanding the relative rules to give:
>
> top:
> WEEKDAY AFTER_KWD NAME BEFORE_KWD NAME FAILS_KWD top {()}
> | WEEKDAY AFTER_KWD NAME {()}
> | WEEKDAY BEFORE_KWD NAME {()}
> ;
>
> I've tried a couple of tricks with %prec but can't get the parser to come
> out the same way with the first rule... please could someone put me out of
> my misery!!
>
> Thanks,
>
>
> David
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
--
Yann
next prev parent reply other threads:[~2006-10-24 21:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-24 21:04 David Allsopp
2006-10-24 21:40 ` Yann Régis-Gianas [this message]
2006-10-24 22:32 ` [Caml-list] " skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1af89fca0610241440j202e9c43m3025d2395b456f34@mail.gmail.com \
--to=yann.regisgianas@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=dra-news@metastack.com \
--cc=yann@regis-gianas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox