From: David MENTRE <dmentre@linux-france.org>
To: caml users <caml-list@inria.fr>
Subject: [Caml-list] Re: Priority issue in an ocamlyacc grammar
Date: Fri, 11 Feb 2011 10:59:56 +0100 [thread overview]
Message-ID: <AANLkTimcLfwkD0q77EQvd26jR4ssBCQuN1p6zO=roays@mail.gmail.com> (raw)
In-Reply-To: <AANLkTimV=JHSBj2QH=Y2SrKGYUxFgtenzE=DU70o5Dpj@mail.gmail.com>
Hello,
2011/2/11 David MENTRE <dmentre@linux-france.org>:
> Then, I define in my grammar a rule to parse an expression (exp):
> """
> exp: LPAREN exp RPAREN { $2 }
> | INT MAPLET IDENTIFIER %prec MAPLET { Enum_value($1, $3) }
> | NOT LPAREN exp RPAREN { Not($3) }
> | exp SPACES EQUAL SPACES exp %prec EQUAL { Equal($1, $5) }
> | exp SPACES AND SPACES exp %prec AND { And($1, $5) }
> | exp SPACES OR SPACES exp %prec OR { Or($1, $5) }
> | exp SPACES IMPLY SPACES exp %prec IMPLY { Imply($1, $5) }
> | exp SPACES EQUALEQUAL SPACES exp { Equalequal($1, $5) }
...
> """
...
> It appears that the OR operator binds more tightly than the EQUAL operator!
I've found it: the SPACES token did not allow to chose the correct
rule while parsing. Removing it brings a correct parsed tree.
Regards,
david
prev parent reply other threads:[~2011-02-11 10:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-11 8:46 [Caml-list] " David MENTRE
2011-02-11 9:59 ` David MENTRE [this message]
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='AANLkTimcLfwkD0q77EQvd26jR4ssBCQuN1p6zO=roays@mail.gmail.com' \
--to=dmentre@linux-france.org \
--cc=caml-list@inria.fr \
/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