caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Markus Mottl" <markus.mottl@gmail.com>
To: "Jean-Marie Gaillourdet" <jm@gaillourdet.net>
Cc: ocaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Partial parsing
Date: Fri, 28 Jul 2006 10:01:04 -0400	[thread overview]
Message-ID: <f8560b80607280701x20b8370dp3bcdf24ac53483fa@mail.gmail.com> (raw)
In-Reply-To: <244C09B7-E152-4B9E-8B7E-A27AC225B5E7@gaillourdet.net>

On 7/28/06, Jean-Marie Gaillourdet <jm@gaillourdet.net> wrote:
> You could implement such a feature on top of the existing lexer and
> parser technologies by using thread. Dedicate one thread to the lexer
> and parser, make the input buffer blocking and  make every suitable
> intermediate result available to the main thread.

I'd rather not depend on extra threads for parsing.  Besides of them
making things complicated, in my case I also need to be able to deal
with nonblocking / interruptable input functions.

> But I have not much experience with continuations. And I am not sure
> whether that really fits into the framework of ocamllex/ocamlyacc.

I think it would work well: instead of returning a token stream, the
lexer should return a stream of either matched tokens or
continuations.  The parser would consume the recognized tokens, or
return another continuation that would continue lexing/parsing.

> As Fermin Reig pointed out parser combinators provide that feature
> out of the box. AFAIK, they depend on lazy evaluation. I am not sure
> whether those libraries for OCaml are available to hide that or not.

Sure, implementing some parser combinators might be an option, but I'm
otherwise quite happy with the ease of specification and the high
efficiency of ocamllex/ocamlyacc generated parsers.  It's just that
interrupting and resuming parsing is currently not an option.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


      reply	other threads:[~2006-07-28 14:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-27 22:37 Markus Mottl
2006-07-27 22:57 ` [Caml-list] " Fermin Reig
2006-07-28 13:39   ` Sebastien Ferre
2006-07-28  9:58 ` Jean-Marie Gaillourdet
2006-07-28 14:01   ` Markus Mottl [this message]

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=f8560b80607280701x20b8370dp3bcdf24ac53483fa@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=jm@gaillourdet.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;
as well as URLs for NNTP newsgroup(s).