From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 6E8FDBC69 for ; Fri, 6 Jul 2007 06:40:35 +0200 (CEST) Received: from ipmail03.adl2.internode.on.net (ipmail03.adl2.internode.on.net [203.16.214.135]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l664eWwi002083 for ; Fri, 6 Jul 2007 06:40:33 +0200 X-IronPort-AV: E=Sophos;i="4.16,505,1175437800"; d="scan'208";a="112308579" Received: from ppp121-44-3-31.lns4.syd7.internode.on.net (HELO [192.168.1.201]) ([121.44.3.31]) by ipmail03.adl2.internode.on.net with ESMTP; 06 Jul 2007 14:10:25 +0930 Subject: Re: [Caml-list] Incremental, undoable parsing in OCaml as the From: skaller To: oleg@pobox.com Cc: psnively@mac.com, caml-list@inria.fr In-Reply-To: <20070705230000.10763AD43@Adric.metnet.fnmoc.navy.mil> References: <20070705230000.10763AD43@Adric.metnet.fnmoc.navy.mil> Content-Type: text/plain Date: Fri, 06 Jul 2007 14:40:24 +1000 Message-Id: <1183696824.29802.51.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 468DC7C0.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 oleg:01 parsers:01 delimited:01 ocaml:01 monadic:01 bytecode:01 byte-code:01 monadic:01 parser:01 parser:01 bytecode:01 ocaml's:01 patching:01 stack:01 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 Felix, successor to C++: http://felix.sf.net