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 KAA01735; Thu, 13 Sep 2001 10:48:59 +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 KAA01417 for ; Thu, 13 Sep 2001 10:48:58 +0200 (MET DST) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f8D8mrP07260; Thu, 13 Sep 2001 10:48:53 +0200 (MET DST) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id KAA28434; Thu, 13 Sep 2001 10:48:53 +0200 Date: Thu, 13 Sep 2001 10:48:53 +0200 From: Daniel de Rauglaudre To: SooHyoung Oh Cc: caml-list Subject: Re: [Caml-list] function vs. parser Message-ID: <20010913104853.M24601@verdot.inria.fr> References: <006501c13c2c$e833eff0$1e01a8c0@hama> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <006501c13c2c$e833eff0$1e01a8c0@hama>; from shoh@duonix.com on Thu, Sep 13, 2001 at 05:20:11PM +0900 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Thu, Sep 13, 2001 at 05:20:11PM +0900, SooHyoung Oh wrote: > Could anyone explain me why "parser" was introduced in Ocaml? > As you know, "function" is using in the caml light-instead of "parser". > "parser" must be a reserved word like "let" and "function", right? Right: "parser" is used because they are not functions. In Caml Light, we used "function", but it was an bad idea: the pattern matching rules in parsers have nothing to do with the pattern matching rules in functions and it was important to separate the notions. Another reason is that in OCaml, after "parser" (and after the streams patterns), you can put a pattern to bind the current stream count: parser bp [< .... >] ep -> (* bp: stream count before the matching; ep: stream count after the matching *) | [< .... >] ep -> (* same... *) | ... With "function", the language would be more complicated to parse. -- Daniel de RAUGLAUDRE daniel.de_rauglaudre@inria.fr http://cristal.inria.fr/~ddr/ ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr