From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA22908; Tue, 28 May 2002 20:01:27 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA22733 for ; Tue, 28 May 2002 20:01:26 +0200 (MET DST) Received: from laurelin.dementia.org ([208.167.88.73]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g4SI1Pv24943 for ; Tue, 28 May 2002 20:01:25 +0200 (MET DST) Received: by laurelin.dementia.org (Postfix, from userid 1001) id 9960A7099; Tue, 28 May 2002 14:07:07 -0400 (EDT) To: dengping zhu Cc: John Prevost , Ocaml Subject: Re: [Caml-list] infix precedence References: From: John Prevost Date: 28 May 2002 14:07:07 -0400 In-Reply-To: Message-ID: <86g00cf8ok.fsf@laurelin.dementia.org> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >>>>> "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. 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