Re: PEG Patches

2011-03-31 Thread Noah Lavine
Hello again, I was about to do this, and then I discovered that it wouldn't work, because there are a few special case PEGs that don't make sense as macros. Specifically, in the context of a PEG, we interpret strings as matching themselves, and those can't be made into macros. So I went ahead and

Re: PEG Patches

2011-03-29 Thread Andy Wingo
On Tue 29 Mar 2011 14:47, Noah Lavine writes: >> (define-peg-matcher and cg-and) > > That's doable. But if we're going to choose what to do entirely based > on the first element of the list, then we could also just not define > peg-sexp-compile at all and make each of the code generation function

Re: PEG Patches

2011-03-29 Thread Noah Lavine
> This last is the best.  What if we define a module that serves as a > registry of PEG match behaviors, like `(ice-9 peg matchers)'.  Then we > define `define-peg-matcher' or something, so that we can: > > (define-peg-matcher and cg-and) > > where define-peg-matcher is > > (define-syntax define-pe

Re: PEG Patches

2011-03-29 Thread Andy Wingo
On Mon 28 Mar 2011 22:44, Noah Lavine writes: > - say that string PEGs can only occur at the top level of a PEG > expression. The peg module has never been released, so no one uses > this feature now anyway. > - instead of defining a new function peg-extended-compile, redefine > peg-sexp-compil

Re: PEG Patches

2011-03-28 Thread Michael Lucy
A variant on the second option would be first defining peg-string-compile to just throw an error, then redefining it later to actually compile the string. That seems a little less hackish, at least to me. A fifth option would be to make peg-sexp-compile take an optional argument FUN-RECUR that it

Re: PEG Patches

2011-03-28 Thread Noah Lavine
> I've been working on that. The attached two patches break the > circularity. The code still isn't organized brilliantly, but after > applying these I think we would only want pretty minor cleanups before > merging PEG into the main branch. Actually, forget this bit. I wrote it before I remembere

Re: PEG Patches

2011-03-28 Thread Noah Lavine
Hi, > I think the solution is to confront the circularity directly.  It exists > because the PEG s-exp grammar also deals with the string grammar, which > needs an already-build PEG parser. > > Let's break it instead into layers without cycles: removing the string > grammar from the s-exp code gen

Re: PEG Patches

2011-03-25 Thread Andy Wingo
On Sun 06 Mar 2011 06:25, Noah Lavine writes: > Attached is a series of patches I've made for the wip-mlucy branch. It > splits the PEG code into several little modules which go in > module/ice-9/peg/. The original peg source file becomes very little. > At the end it finally loses its big eval-wh

Re: PEG Patches

2011-03-06 Thread Noah Lavine
Here's another patch, which in retrospect may be the most useful of the series. It adds a section called "PEG Internals" to the manual, and begins documenting how PEG actually works. This should make hacking PEG a lot easier. Noah On Sun, Mar 6, 2011 at 12:25 AM, Noah Lavine wrote: > Hello all,