unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* PEG Parser
@ 2011-01-13 21:29 Noah Lavine
  2011-01-17 21:32 ` Ludovic Courtès
  0 siblings, 1 reply; 27+ messages in thread
From: Noah Lavine @ 2011-01-13 21:29 UTC (permalink / raw)
  To: guile-devel

Hello all,

I was just looking at the PEG parser code, which is currently in the
"mlucy" branch of the Guile repo. I was looking at it to see if it was
ready to be merged.

First of all, it passes its test suite. This is pretty good, because
its test suite includes a grammar for itself, a grammar for basic
mathematical equations, and a grammar for parsing /etc/passwd files.
These all seem like good examples of things you'd want to parse.

I also looked at the code. It's pretty clear. I like the way it does
code generation by defining lots of little functions that generate
bits of code and then calling those functions. I tried to compare its
style to the existing LALR parser generator, but they're too different
- the LALR generator computes tables in advance but doesn't seem to
actually generate code (it just uses a pre-written driver function),
whereas the PEG parser generator doesn't do much other than generating
code. Also, the way it handles parsing descriptions of grammar is
really elegant - it first defines its code generator using an
s-expression representation of grammars, then uses an s-expression
representation of PEG grammar descriptions to parse PEG grammars
written as strings.

The only thing that seemed really weird is the macro safe-bind, which
basically reimplements hygienic macros. It's used all over the place
in the function-generating code. I also saw a couple of lines that
were too long, but not many, and the whole thing could be split into a
few modules, but it's not that long the way it is, so neither of those
seem like big issues. It could also stand to have a bigger test suite
(as the test suite itself says).

In summary, I think the code is good and functional, and should be
merged into Guile. I think it would also be very useful to have a PEG
parser generator.

Noah



^ permalink raw reply	[flat|nested] 27+ messages in thread
* PEG Parser
@ 2010-05-27  5:19 Michael Lucy
  0 siblings, 0 replies; 27+ messages in thread
From: Michael Lucy @ 2010-05-27  5:19 UTC (permalink / raw)
  To: guile-devel

Hi,

I'm another of the GSOC students--I figured I'd introduce myself since
I may be asking questions on this list.  I'm going to be writing a PEG
parser/matcher for Guile.  My paperwork is still working its way
through the system so I can't point to any repositories where my code
will be yet, but it should be pretty well-labeled once it's in there
if anybody wants to take a look at it.



^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2011-03-04 13:09 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-13 21:29 PEG Parser Noah Lavine
2011-01-17 21:32 ` Ludovic Courtès
2011-01-21 15:23   ` Noah Lavine
2011-01-22 21:02     ` Ludovic Courtès
2011-01-24  1:29       ` Noah Lavine
2011-01-24 20:55         ` Ludovic Courtès
2011-01-27  1:40         ` Noah Lavine
2011-01-27  2:23           ` Michael Lucy
2011-01-27  2:38             ` Noah Lavine
2011-01-27  3:02               ` Michael Lucy
2011-01-27  5:17                 ` Noah Lavine
2011-01-28  3:25                   ` Noah Lavine
2011-01-28  5:13                     ` Michael Lucy
2011-01-28 15:48                   ` Andy Wingo
2011-01-29  3:07                     ` Noah Lavine
2011-01-29  4:15                       ` Michael Lucy
2011-01-29 11:34                         ` Andy Wingo
2011-01-29 19:37                           ` Noah Lavine
2011-01-30 11:43                             ` Andy Wingo
2011-02-02  0:26                               ` Noah Lavine
2011-02-06 15:31                                 ` Noah Lavine
2011-02-18 22:03                                 ` Andy Wingo
2011-02-23 15:10                                   ` Noah Lavine
2011-03-04 10:52                                     ` Andy Wingo
2011-03-04 13:09                                       ` Noah Lavine
2011-01-29 11:33                       ` Andy Wingo
  -- strict thread matches above, loose matches on Subject: below --
2010-05-27  5:19 Michael Lucy

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 read-only IMAP folder(s) and NNTP newsgroup(s).