Browse thread
[Caml-list] infix precedence
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2002-05-28 (17:19) |
From: | dengping zhu <zhudp@c...> |
Subject: | Re: [Caml-list] infix precedence |
Thanks for your prompt reply. So, the associativity also the same as the first character. Then, I have problems with the following code. In SML, I defined a few infix as follows: infixr 4 << >> infixr 3 && infix 2 -- ## infix 2 wth suchthat return guard infixr 1 || I want to convert these code into ocaml. How can find so many different 'first characters'? Because the available characters in ocaml are: **... right *... /... %... left +... -... left @... ^... right Do you have any sugestion? Thanks a lot! Dengping On 28 May 2002, John Prevost wrote: >>>>>> "zd" == dengping zhu <zhudp@cs.bu.edu> writes: > > zd> Hi, all, I have a question about the precedence of infix in > zd> ocaml. I define a few infixes as follow: > > zd> let (^^) x y = ... let (^+) x y = ... let (^<) x y = ... > > zd> Now how can I define the precedence of them? At first, I want > zd> to use brackets to solve it, but later I find out it is almost > zd> impossible because there are a lot of recursive functions and > zd> combination of these infixes. > > zd> Can you give me any idea? Thanks a lot! > >The precedence and fixity of the infix is determined by the first character. This is why most "families" of infixes look like: > >^^ >+^ ><^ > >rather than > >^^ >^+ >^< > >John. > ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners