Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] infix precedence
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-05-28 (18:01)
From: John Prevost <j.prevost@c...>
Subject: Re: [Caml-list] infix precedence
>>>>> "zd" == dengping zhu <> writes:

    zd> I want to convert these code into ocaml. How can find so many
    zd> different 'first characters'? Because the available characters
    zd> in ocaml are:

    zd> **...  right *... /... %...  left +... -...  left @... ^...
    zd> right

    zd> Do you have any sugestion?

Take a look at section 6.7 of the manual for precedence rules, and
section 6.1 (under the heading "Prefix and infix symbols") for the
list of symbols.  In short, this is the list of all the available
infix symbols, in order of precedence:

!... ?... ~...                          prefix
**...                                   right
*... /... %...                          left
+... -...                               left
@... ^...                               right
=... <... >... |... &... $... %...      left

This means that you might have some trouble with your infix levels,
but there are normally ways to organize things for what you'd like.  I
find, also, that having just a few levels and using parenthesis for
the rest of the time can work quite well.  As you note, using this
style for everything can be painful, but having infixes for only a few
specific things can help immensely.


To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: