unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Michael Lucy <MichaelGLucy@Gmail.com>
Cc: guile-devel@gnu.org
Subject: Re: GSOC PEG project
Date: Thu, 08 Jul 2010 11:29:33 +0100	[thread overview]
Message-ID: <m3sk3us1v6.fsf@unquote.localdomain> (raw)
In-Reply-To: <AANLkTimlR-fI_EMXoTlR336FH7MedIgpkcTtWqirzJux@mail.gmail.com> (Michael Lucy's message of "Mon, 5 Jul 2010 01:05:52 -0500")

Hi Michael,

I am travelling currently, so a bit of asynchronicity in the reply :)

On Mon 05 Jul 2010 07:05, Michael Lucy <MichaelGLucy@Gmail.com> writes:

> I finally got things into a usable state, so I pushed out what I have
> to origin/mlucy.

Great news!

> Files I've added so far:
> guile/modules/ice-9/peg.scm (I assume this is the right place to put this?)

Probably, yes, for parts of PEG to be available as macros and
procedures. You would probably want a language implementation as well,
for string-based PEGs.

> PEG compiler: Works for all the grammars I've tested, no known bugs.
> Currently compiles to Scheme code rather than Tree-IL for debugging.

That is the right thing to do. Most of PEG should be available through
macros and procedures.

> Comments: Pretty good I think, but I could stand to have more.

Yes, it readable at a quick glance.

> External documentation: None so far.

A .texi file will be good, alongside the LALR(1) parser.

> Syntactic Sugar: Canonical string-based PEGs can be parsed just fine.

Cool!

> Testing: Small test suite.  Needs to be standardized with the other .test files.

Great.

> Benchmarks: None so far, but I haven't really done any optimization so
> I'd bet it performs poorly.

Well, it's good to have work left to do :)

> Problems:
>
> 1. PEG compiler compiles to scheme code rather than TREE-IL, and uses
> some custom pieces of syntax that I then have to export.  I've been
> meaning to ask, how big a deal is this?  I originally had it compile
> to Scheme while I was debugging things, but the Scheme gets compiled
> down to TREE-IL form, right?  Should I fix it to compile straight to
> TREE-IL anyway rather than just finding a way to get around having to
> export all that syntax?

No it should compile to Scheme. However the biggest problem with your
code is that it is implemented with define-macro. You should change it
to be implemented with syntax-case. Please let me know if you need help.

Syntax-case is a bit trickier in some ways than define-macro, but it's
simpler in others (e.g., no need for your `safe-bind' macro). Check out
"Macros" in the manual (from git) and tell me what's confusing there; it
was only fleshed out with info on syntax-case recently.

> 2. Tests aren't standardized (peg.test looks nothing like the other
> .test files).

This isn't a big deal

> 3. This:
>
> scheme@(guile-user)> (use-modules (ice-9 peg))
> ;;; note: source file /home/zededarian/guile/module/ice-9/peg.scm
> ;;;       newer than compiled
> /home/zededarian/guile/cache/guile/ccache/2.0-0.R-LE-4/home/zededarian/guile/module/ice-9/peg.scm.go
> ;;; note: autocompilation is enabled, set GUILE_AUTO_COMPILE=0
> ;;;       or pass the --no-autocompile argument to disable.
> ;;; compiling /home/zededarian/guile/module/ice-9/peg.scm
> ;;; WARNING: compilation of /home/zededarian/guile/module/ice-9/peg.scm failed:
> ;;; key wrong-type-arg, throw args ("vm-debug-engine" "Wrong type to
> apply: ~S" (#f) (#f))
>
> Somehow it works fine despite the warnings.  Can anybody shed light on
> what this means?

Dunno! We'll look at it after getting the macro situation sorted
out. You can try:

  (use-modules (system base compile))
  (compile-file "module/ice-9/peg.scm")

and see where the debugger leaves you.

> 5. The pretty-print module doesn't get loaded when peg does, and some
> of my functions use it.  I have:
>
> :use-module (ice-9 pretty-print)
>
> in my define-module form at the top of peg.scm; shouldn't that take
> care of it?

Yep, that should work.

> Any thoughts or comments?  I'm sorry I didn't get this into a branch earlier.

Heh, no problem. I'm looking forward to a lean mean PEG parsing machine!

Andy
-- 
http://wingolog.org/



  parent reply	other threads:[~2010-07-08 10:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-05  6:05 GSOC PEG project Michael Lucy
2010-07-05 22:40 ` Ludovic Courtès
2010-07-05 23:59   ` Michael Lucy
2010-07-06  1:41     ` No Itisnt
2010-07-06 21:37       ` Ludovic Courtès
2010-07-08 16:23       ` Andy Wingo
2010-07-08 16:21     ` Andy Wingo
2010-07-11  7:48       ` Michael Lucy
2010-07-17 12:21         ` Andy Wingo
2010-07-17 12:56           ` Ludovic Courtès
2010-07-18 11:57             ` Andy Wingo
2010-07-08 10:29 ` Andy Wingo [this message]
2010-07-09  7:58   ` Michael Lucy
2010-07-10  9:49     ` Michael Lucy
2010-07-17 12:19     ` Andy Wingo

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

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3sk3us1v6.fsf@unquote.localdomain \
    --to=wingo@pobox.com \
    --cc=MichaelGLucy@Gmail.com \
    --cc=guile-devel@gnu.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).