Browse thread
Incremental, undoable parsing in OCaml as the general parser inversion
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | skaller <skaller@u...> |
| Subject: | Re: [Caml-list] Incremental, undoable parsing in OCaml as the |
On Thu, 2007-07-05 at 16:00 -0700, oleg@pobox.com wrote: > The claim of *mechanical*, automatic and universal inversion of > existing, unmodified, separately compiled parsers, etc. stands. > > I believe we have a mis-understanding. Probably. > 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. So we agree, the monadic implementation requires a rewrite. > 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. Obviously you have rewrite the interfaces.. :) But yes, this seems to be the source of confusion. A bytecode version is not only feasible .. Ocaml's vmthreads have already provided control inversion for years -- but only for blocking I/O operations. Native code control inversion is not so easy. In absence of foreign code (C code or whatever) it can probably be done most easily by patching Ocaml native code generators so they stop using the stack and use a heap based spaghetti stack instead. Inversion by copying or switching stacks in a more general context isn't possible, unfortunately. By 'more general' I mean in the presence of arbitrary foreign code 'up stack'. For example, you can't expect C++ callbacks which throw exceptions to work if you fiddle the stack. I think Hans Boehm has the most data on this, since to implement his conservative collector he needs to know where just about everything is on a wide class of platforms. [However Felix compiler is 100% pure ocaml.. ] -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net