caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Daniel Bünzli" <daniel.buenzli@erratique.ch>
To: Tom Ridge <tom.j.ridge+caml@googlemail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] First release of P3: a combinator parser library, and parser generator
Date: Mon, 8 Apr 2013 13:29:43 +0100	[thread overview]
Message-ID: <9FBB950CE8A047D9990785F9ACF3608E@erratique.ch> (raw)
In-Reply-To: <CABooLwMvqgTy6WP14dbK38TYKkLOV7wmxuP3X0fXWOYfWGG23A@mail.gmail.com>

Le lundi, 8 avril 2013 à 12:33, Tom Ridge a écrit :
> Yes, I need to do something here. At the moment, there is no real handling of errors, and nothing to support error correction (I'm not completely sure what error correction is).

In hand made parsers you rewind/fast forward your parser state to get it in a state where it may parse sensible things again (e.g. a "toplevel" construct, or the next element in a list-like construct), this can be done for example by closing/ignoring mismatched parentheses etc. Essentially this means discarding part of the input or introducing tokens not present in the input.

While this may result in wrong error reports, you always end with a complete (albeit broken from the user's intent) parse tree. The advantage is that in certain cases you can report more than one syntax error during parsing (since this tends to result in cascading errors you usually set an upper error reporting bound).  

With the combinator approach, see for example [1,2] (I don't know if there were further developments in that area, these were the papers I was reading at the time).

Best,

Daniel

[1]
Swierstra, S.D. (2001).  
Combinator Parsers: From Toys to Tools.  
In G. Hutton (Ed.),  
Electronic Notes in Theoretical Computer Science. Elsevier Science Publishers.  


[2]
Hughes, R.J.M. & Swierstra, S.D. (2003).  
Polish Parsers, Step by Step.  
In
Eighth ACM Sigplan International Conference on Functional Programming
(pp. 239-248). New York: ACM Press.  



      reply	other threads:[~2013-04-08 12:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 10:28 Tom Ridge
2013-04-08 11:03 ` Daniel Bünzli
2013-04-08 11:33   ` Tom Ridge
2013-04-08 12:29     ` Daniel Bünzli [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=9FBB950CE8A047D9990785F9ACF3608E@erratique.ch \
    --to=daniel.buenzli@erratique.ch \
    --cc=caml-list@inria.fr \
    --cc=tom.j.ridge+caml@googlemail.com \
    /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).