caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Aleksey Nogin <nogin@metaprl.org>
To: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] ocamlyacc, menhir, dypgen, camp4, elkhound
Date: Sat, 17 Mar 2007 10:12:54 -0700	[thread overview]
Message-ID: <45FC2196.8060704@metaprl.org> (raw)
In-Reply-To: <45FB033A.5040201@univ-savoie.fr>

Christophe,

I am not an expert in camlp4, but I probably know enough to be able to
fill in a few blanks in the last column of your table. My answers are
based on "old" 3.09 camlp4 and might be different for the new 3.10 one.

Handled grammar: LL(1)

Reentrant: Yes, but with caveats(*1)

Extensible (an action can change the grammar): Yes(*2)

Parametrized non terminal: No (???, *3)

Splitting the definition of a non terminal: Yes

Grammars parametrized by Ocaml modules: ??? (Yes? - *4)

Partial action: No

Ambiguous grammars: Yes (???, *5)

Exception to reject a rule: No (???)

Priority: Using levels (= a partial order as a relation) + associativity
direction

Debugging grammars: hard

---

(*1) In 3.09, reentrant parsing works, except the error messages might
end up pointing to the wrong place in the source stream (supposed to be
fixed in 3.10, AFAIK). However, there is no good way of passing a state
to the grammar actions. As a result, one often has to resort to using a
global ref to hold the state, which, obviously, kills the ability to be
reentrant.

(*2) For example, see the pa_macro where the action for the DEFINE and
UNDEF expressions change the grammar accordingly.

(*3) As far as I understand, only tokens
can be parameterized, although that might have changed in 3.10.

(*4) I am not sure which capability exactly is meant here. In Camlp4,
the grammar definitions/extensions can be done inside a body of a
functor. The actual grammar is created when the functor is applied.

(*5) Not sure what is meant here. In camlp4, unfortunately, there is no
way to test the grammar for ambiguities - it accepts an ambiguous
grammar without any warnings.

Aleksey

On 16.03.2007 13:51, Christophe Raffalli wrote:

> 
> Hi,
> 
> The programs listed in the subject of this mail are parser generators
> for OCaml ...
> There may be others, and there is also the possibility to write parsers
> by hand using stream pattern matching, parser combinators, etc ...
> (the later technics are not covered here)
> 
> It would be nice to have a small comparison table to help people making
> a decision ? Being not neutral
> (dypgen was developped by a student at ENS lyon under my direction) I
> think I should not do it myself ...
> 
> But I gave it a try. Here is a first draft (This table is not correct
> yet and should not be used to make a decision ;-)
> 
> http://www.lama.univ-savoie.fr/~raffalli/ocaml-parsing.html
> 
> The html produced by ooffice is poor and the calculator example is not
> well presented due to an ooffice bug (I think).
> 
> Questions
> 
> - Can you help me complete the table (missing lines, columns, 
> inaccurate or missing information) ?
> - Can you provide the best possible calculator example for the other
> parser as a text file ?
> - Can you provide a really difficult but short grammar to make a better
> comparison ?
> - Other Idea welcome
> - If someone neutral wants to volonteer to host this comparison table, I
> will be very please to send him the source of the table.
> 
> Christophe Raffalli
> 
> 
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 


  reply	other threads:[~2007-03-17 17:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-16 20:51 Christophe Raffalli
2007-03-17 17:12 ` Aleksey Nogin [this message]
2007-03-17 22:21 ` [Caml-list] " Tom

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=45FC2196.8060704@metaprl.org \
    --to=nogin@metaprl.org \
    --cc=Christophe.Raffalli@univ-savoie.fr \
    --cc=caml-list@inria.fr \
    /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).