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 JAA17524; Fri, 12 Jul 2002 09:24:32 +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 JAA17527 for ; Fri, 12 Jul 2002 09:24:32 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g6C7OSr10539; Fri, 12 Jul 2002 09:24:28 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA17517; Fri, 12 Jul 2002 09:24:27 +0200 (MET DST) From: Pierre Weis Message-Id: <200207120724.JAA17517@pauillac.inria.fr> Subject: Re: [Caml-list] Functional scanning facilities In-Reply-To: <86r8i93bti.fsf@laurelin.dementia.org> from John Prevost at "Jul 11, 102 10:43:53 pm" To: j.prevost@cs.cmu.edu (John Prevost) Date: Fri, 12 Jul 2002 09:24:27 +0200 (MET DST) Cc: alex@baretta.com, caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > >>>>> "ab" == Alessandro Baretta writes: > > ab> How about something like the follwing--the idea coming from > ab> posts I read a while ago about CPS programming: > > It works quite well. Take a look at Lindig's O'Caml implementation of > parser combinators at http://www.gaertner.de/~lindig/software/mylib.html > > A more complete description of how these work (expressed monadically) > is available in a paper by Hutton and Meijer at > http://www.cs.nott.ac.uk/~gmh/monparsing.pdf > > These techniques can be applied quite easily in O'Caml, although the > way infix definitions work leads to some rather... interesting choices > of symbols. > > 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 Em, sorry to interrupt you: I'm a fan of combinators since decades (my thesis was entitled something like ``compiling with combinators''), I also do love lambda-calculus and monades that I consider extremely elegant and powerful theoretical tools, but wait, wait, wait ... Here, we want to design and implement a practical, compact, simple to understand, and easy way to print and scan in the context of a functional language with full-fledged imperative features (we are not in a lazy context where monades are mandatory anyway). In this favourable situation, I'm afraid no combinatorial approach can compete with the readability and compactness of C-style formats. In addition, from the user's point of view, the seamingly flat first-order typing simplicity of Caml printf (and now scanf) primitives will be extremely hard to beat. Let alone the strongly symetrical status and overall treatment of scanf and printf that is so wonderful in the actual implementation of the Objective Caml library. Note that I am so enthousiastic about the new Scanf module because this problem of implementing a C-like scanf facility in Caml was a background thread in my head for at least 5 years, before I found the tricks that lead to the actual scanf implementation ... Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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