Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: oleg@pobox.com
To: skaller@users.sourceforge.net
Cc: psnively@mac.com, caml-list@inria.fr
Subject: Re: [Caml-list] Incremental, undoable parsing in OCaml as the
Date: Thu,  5 Jul 2007 16:00:00 -0700 (PDT)	[thread overview]
Message-ID: <20070705230000.10763AD43@Adric.metnet.fnmoc.navy.mil> (raw)
In-Reply-To: <1183639151.12890.19.camel@rosella.wigram>


The claim of *mechanical*, automatic and universal inversion of
existing, unmodified, separately compiled parsers, etc. stands.

I believe we have a mis-understanding. There are TWO implementations
of delimited continuations for OCaml. One is the monadic, implemented
in pure 100% OCaml and available for both bytecode and native
compilers. The other is non-monadic implementation, which is at
present available for byte-code only. Paul Snively asked we about the
first, monadic one. To use that implementation, one indeed has to
re-write the parser and everything else for that matter in monadic
style.

The original message was talking about the non-monadic, direct style
approach. There, the inversion of the parser works automatically and
mechanically. There is no need to re-write the parser or anything
else.


John Skaller wrote:
> What you've shown is that it is possible to *manually*
> control invert a given algorithm.
>
> Now you should note what Felix does. It *mechanically*
> control inverts any algorithm encoded with Felix procedures.
> And I mean *concrete syntax* here :)

The original message demonstrated how to *mechanically* and
automatically invert the given algorithm. You could have tried it
yourself: the runnable code was included. The code specifically used
Genlex.make_lexer from the standard library as it is. The code also
used Stream.iter, Stream.from and other library functions -- as they
are, as they *had* been compiled and placed in the standard
library. No modifications were done to any of these functions.

> But this isn't so, because you confuse the meaning of 'parser'
> and 'implementation' to a programmer, as compared to a
> theoretician. A programmer thinks an 'implementation' is
> concrete syntax .. i.e. an actual text file.. a theoretician's
> 'concrete syntax' is still an abstract encoding.

I assure you that I'm an industrial programmer and I don't confuse
concrete with abstract syntax. When the message said that the
procedure to invert a parser is mechanical and independent of the
parser implementation, it meant exactly that and for what _you_ call
`concrete syntax'. The message itself contained the proof: the
complete code. If you consider that evidence unsatisfactory, please
send me your parser (that can be compiled with OCaml 3.09) and I will
send you the proof of inversion without modifying a bit of your
code. You can run that code for yourself. You could just send me
compiled *.cmi and *cmo files instead (but I need to check the precise
version of my system then so it can load your files).


> This shows that monads have all the same problems as
> ordinary imperative code if you over use them
> (as of course is common practice in low level procedural
> programming languages).

Partly I agree with you. Still, with monad and an expressive type
system, one can do better (for example, assure that operations on
memory pointers respect alignment and sizes of memory area, even if we
permit pointer arithmetic). That was the subject of a recent paper on
strongly typed memory areas
	http://okmij.org/ftp/Computation/resource-aware-prog/tfp.pdf
We can even statically reason about some timing constraints.


Paul Snively wrote:
> what the issues in providing delimited continuations natively for
> ocamlopt are?

I guess the major issue is of not actually trying. I believe the
simple and inefficient version (which just copies the stack) can be
done relatively quickly. I need to check if there are any absolute
pointers in the stack to locations on the stack itself (but I don't
think they are). In any case, frame tables describe exactly what is on
the stack. A more efficient version is to make the stack segmented;
that takes longer.


  reply	other threads:[~2007-07-05 23:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-03 11:38 Incremental, undoable parsing in OCaml as the general parser inversion oleg
2007-07-03 15:28 ` [Caml-list] " skaller
2007-07-04 19:41 ` Paul Snively
2007-07-04 23:42   ` Paul Snively
2007-07-05  8:13     ` oleg
2007-07-05 12:39       ` skaller
2007-07-05 23:00         ` oleg [this message]
2007-07-06  4:40           ` [Caml-list] Incremental, undoable parsing in OCaml as the skaller
2007-07-05 13:23       ` [Caml-list] Incremental, undoable parsing in OCaml as the general parser inversion skaller
2007-07-05 13:54       ` Paul Snively

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=20070705230000.10763AD43@Adric.metnet.fnmoc.navy.mil \
    --to=oleg@pobox.com \
    --cc=caml-list@inria.fr \
    --cc=psnively@mac.com \
    --cc=skaller@users.sourceforge.net \
    /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