[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GSOC PEG project
From: |
Andy Wingo |
Subject: |
Re: GSOC PEG project |
Date: |
Thu, 08 Jul 2010 11:29:33 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) |
Hi Michael,
I am travelling currently, so a bit of asynchronicity in the reply :)
On Mon 05 Jul 2010 07:05, Michael Lucy <address@hidden> 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/
- Re: GSOC PEG project, (continued)
- Re: GSOC PEG project, Ludovic Courtès, 2010/07/05
- Re: GSOC PEG project, Michael Lucy, 2010/07/05
- Re: GSOC PEG project, Andy Wingo, 2010/07/09
- Re: GSOC PEG project, Michael Lucy, 2010/07/11
- Re: GSOC PEG project, Andy Wingo, 2010/07/17
- Re: GSOC PEG project, Ludovic Courtès, 2010/07/17
- Re: GSOC PEG project, Andy Wingo, 2010/07/18
Re: GSOC PEG project,
Andy Wingo <=