caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Problem with precedence declaration in .mly file
@ 2007-10-30 14:00 Angela Zhu
  2007-10-30 14:20 ` [Caml-list] " Oliver Bandel
       [not found] ` <1193753915.47273d3bb15f2@webmail.in-berlin.de>
  0 siblings, 2 replies; 11+ messages in thread
From: Angela Zhu @ 2007-10-30 14:00 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

Hi all,

I have some problem with precedence declaration in OCaml parser.
If I what to say exponential(ATOB) is prior to *(STAR) and / (DIVIDE),
  * and / are prior to +(PLUS)  and -(MINUS),
I wrote the following in the parser:


/***** Precedence Rules  *****/
...
%left PLUS MINUS
%left STAR DIVIDE
%left ATOB
...

But I still have the following problems:
(1) It appears that the parser
reads "test = 2^2 + 7;" as "test = 2^9" instead of "test = 4+7", which
would follow the conventional order of operations.

(2)It also interprets "test = (1^2)/3 + 1;" as "test = (1 ^ 2
/ (3 + 1));"

Can any one help me to see why it happens? Why the precedence rules  
doesn't work?

Thanks,
Angela
------------------------------------------
Dept. of CS, Rice U.
http://www.cs.rice.edu/~yz2/
------------------------------------------

[-- Attachment #2: Type: text/html, Size: 5311 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-10-31 15:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-30 14:00 Problem with precedence declaration in .mly file Angela Zhu
2007-10-30 14:20 ` [Caml-list] " Oliver Bandel
     [not found] ` <1193753915.47273d3bb15f2@webmail.in-berlin.de>
2007-10-31  4:11   ` Angela Zhu
2007-10-31  4:26   ` Angela Zhu
2007-10-31  5:52     ` skaller
     [not found]       ` <BE3BA36D-7E69-426F-B558-26CBCF9D78F6@cs.rice.edu>
     [not found]         ` <1193814307.8355.68.camel@rosella.wigram>
2007-10-31  7:16           ` Re: " Angela Zhu
2007-10-31 11:52     ` Peter Ilberg
2007-10-31 13:51       ` Angela Zhu
2007-10-31 14:14         ` Thomas Gazagnaire
2007-10-31 14:40           ` Angela Zhu
     [not found]             ` <472894EC.8040902@irisa.fr>
     [not found]               ` <F5672A31-E4C0-488B-B594-F75E3DA262D8@cs.rice.edu>
     [not found]                 ` <47289C47.8020609@irisa.fr>
2007-10-31 15:34                   ` Angela Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).