caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>
To: SooHyoung Oh <shoh@duonix.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] function vs. parser
Date: Thu, 13 Sep 2001 10:48:53 +0200	[thread overview]
Message-ID: <20010913104853.M24601@verdot.inria.fr> (raw)
In-Reply-To: <006501c13c2c$e833eff0$1e01a8c0@hama>; from shoh@duonix.com on Thu, Sep 13, 2001 at 05:20:11PM +0900

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


  reply	other threads:[~2001-09-13  8:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-13  8:20 SooHyoung Oh
2001-09-13  8:48 ` Daniel de Rauglaudre [this message]
2001-09-13 14:13   ` Brian Rogoff
2001-09-13 16:09     ` Daniel de Rauglaudre
2001-09-13 16:50       ` Brian Rogoff
2001-09-13 16:51       ` Pierre Weis
2001-09-13 18:09 Krishnaswami, Neel
2001-09-13 20:55 ` Brian Rogoff
2001-09-13 21:49 Krishnaswami, Neel
2001-09-14 12:50 ` Gerd Stolpmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010913104853.M24601@verdot.inria.fr \
    --to=daniel.de_rauglaudre@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=shoh@duonix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).