Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Functional scanning facilities
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <pierre.weis@i...>
Subject: Re: [Caml-list] Functional scanning facilities
> >>>>> "ab" == Alessandro Baretta <alex@baretta.com> 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