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 SAA28015; Mon, 5 Aug 2002 18:13:25 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA26690 for ; Mon, 5 Aug 2002 18:13:25 +0200 (MET DST) Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.25.148.40]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g75GDMP14579; Mon, 5 Aug 2002 18:13:23 +0200 (MET DST) Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id g75GDHSs007938; Tue, 6 Aug 2002 02:13:17 +1000 (EST) Received: from ozemail.com.au (ppp153.dyn17.pacific.net.au [61.8.17.153]) by wisma.pacific.net.au with ESMTP id CAA04047; Tue, 6 Aug 2002 02:13:16 +1000 (EST) Message-ID: <3D4EA41B.8080502@ozemail.com.au> Date: Tue, 06 Aug 2002 02:13:15 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: Luc Maranget CC: Nicolas Cannasse , OCaml Subject: Re: [Caml-list] Matching when References: <200208050941.LAA0000029449@beaune.inria.fr> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Luc Maranget wrote: >>What you are asking is ``pattern when expression'' to be a pattern. >>Then your example would be parsed as >> >>That is your example is to to be parsed as >> Any <-- pattern | >>| | Pattern (or pat) >> Int x when x > 0 <-- pattern | >>-> >> ... <-- right hand side >> >> >>Modifications are really important because this would make patterns and >>expression mutually recursive, which they are not at the moment. >> The follwing code works in Felix [it prints "YES"] #include match (2,1) with | ( (?x when x>=1), (?y when y >=1)) when x >=2 => { print "YES"; endl; } | _ => { print "NO"; endl; } endmatch; wherein 'when' expressions are part of patterns, and as you can see, can be nested within a pattern -- making the grammar for patterns and expressions mutually recursive. I'm curious as to what problems you perceive with the mutual recursion. -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- 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