PEG Parser

2010-05-26 Thread Michael Lucy
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 c

PEG Parser

2011-01-13 Thread Noah Lavine
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,

Re: PEG Parser

2011-01-17 Thread Ludovic Courtès
Hi! Thanks for looking into this! Perhaps Andy has some insight to share, too? Noah Lavine writes: > 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

Re: PEG Parser

2011-01-21 Thread Noah Lavine
Hello, > “./check-guile --coverage peg.test” can be used to measure code > coverage, normally. I tried running that, but what all I got was this output: Running peg.test Totals for this test run: passes: 21 failures: 0 unexpected passes: 0 expected failures:

Re: PEG Parser

2011-01-22 Thread Ludovic Courtès
Hello! Noah Lavine writes: >> “./check-guile --coverage peg.test” can be used to measure code >> coverage, normally. > > I tried running that, but what all I got was this output: > > Running peg.test > > Totals for this test run: > passes: 21 > failures: 0 > unexpec

Re: PEG Parser

2011-01-23 Thread Noah Lavine
Hello all, > It should have produced $top_builddir/guile.info, which can be used as > input to LCOV to generate an HTML code coverage report > (http://ltp.sourceforge.net/coverage/lcov.php). Oh, that worked. The current tests check 92.6% of the lines in peg.scm, and 90.7% of the functions. I look

Re: PEG Parser

2011-01-24 Thread Ludovic Courtès
Hi, Noah Lavine writes: >> It should have produced $top_builddir/guile.info, which can be used as >> input to LCOV to generate an HTML code coverage report >> (http://ltp.sourceforge.net/coverage/lcov.php). > > Oh, that worked. The current tests check 92.6% of the lines in > peg.scm, and 90.7% o

Re: PEG Parser

2011-01-26 Thread Michael Lucy
Hi, I'm the guy that originally wrote this for GSOC, so I figured I'd jump in. I'd be happy to help with getting the PEG module merge-ready. On Wed, Jan 26, 2011 at 7:40 PM, Noah Lavine wrote: > Hello again, > > I've attached my coverage results. The html file expects the css file > to be in th

Re: PEG Parser

2011-01-26 Thread Noah Lavine
Hello, > I'm the guy that originally wrote this for GSOC, so I figured I'd jump > in.  I'd be happy to help with getting the PEG module merge-ready. Great! > keyword-flatten is described in api-peg.texi.  It's basically a > special case of context-flatten which collapses S-expressions > accordin

Re: PEG Parser

2011-01-26 Thread Michael Lucy
On Wed, Jan 26, 2011 at 8:38 PM, Noah Lavine wrote: > Hello, > >> I'm the guy that originally wrote this for GSOC, so I figured I'd jump >> in.  I'd be happy to help with getting the PEG module merge-ready. > > Great! > >> keyword-flatten is described in api-peg.texi.  It's basically a >> special

Re: PEG Parser

2011-01-26 Thread Noah Lavine
Hi, > It flattens until you have a list where each element either: > 1. Is an atom. > or 2. Is a list whose first element is in the list of keywords. > > So the car of the argument will change if it's a list that doesn't > start with the right keyword.  E.g.: > (keyword-flatten '(a) '((c (a b)) (a

Re: PEG Parser

2011-01-27 Thread Noah Lavine
Hello again, I've run into another issue with the parser that should be addressed in the documentation (or the code?). How do you match a character that is used in the PEG grammar, like "["? Can you only define such matchers via s-expressions? Noah On Thu, Jan 27, 2011 at 12:17 AM, Noah Lavine

Re: PEG Parser

2011-01-28 Thread Michael Lucy
Putting it in single quotes should work. E.g. " '[' ". Similarly, you can add a literal single quote by making it part of a character class. E.g. " ['] ". You're right, I should definitely add something about that to the documentation. Any other weak parts you've noticed while perusing? On Th

Re: PEG Parser

2011-01-28 Thread Andy Wingo
Heya, On Thu 27 Jan 2011 06:17, Noah Lavine writes: > The peg matcher is really awesome. I am glad to be able to use it soon. Indeed! I'm looking forward to having it in Guile. The reason I didn't merge it yet was twofold: (1) the commit logs were not in the standard style, and (2) I wasn't c

Re: PEG Parser

2011-01-28 Thread Noah Lavine
Hello, > Indeed!  I'm looking forward to having it in Guile. Great! I don't intend to be pressuring you to merge it, by the way. I hope my message didn't come across that way. > The reason I didn't merge it yet was twofold: (1) the commit logs were > not in the standard style, and (2) I wasn't c

Re: PEG Parser

2011-01-28 Thread Michael Lucy
On Fri, Jan 28, 2011 at 9:07 PM, Noah Lavine wrote: > Hello, > >> Indeed!  I'm looking forward to having it in Guile. > > Great! I don't intend to be pressuring you to merge it, by the way. I > hope my message didn't come across that way. > >> The reason I didn't merge it yet was twofold: (1) the

Re: PEG Parser

2011-01-29 Thread Andy Wingo
On Sat 29 Jan 2011 04:07, Noah Lavine writes: > Yes, the binding stuff actually seemed very weird to me too, mostly > because it's very non-idiomatic. More specifically, the peg module > does most of its code generation in regular functions rather than > macros. safe-bind implements hygiene for t

Re: PEG Parser

2011-01-29 Thread Andy Wingo
On Sat 29 Jan 2011 05:15, Michael Lucy writes: > Also, macros are notoriously difficult to debug, especially when > they're generating several hundred lines of code that compiles fine > but mysteriously produces the wrong result after a seemingly trivial > change. So porting them from list gener

Re: PEG Parser

2011-01-29 Thread Noah Lavine
Hello all, Sorry for the late notice, but I'm about halfway through porting peg.scm to use hygienic macros, so if anyone else was thinking of doing it, you might want to save your effort for something else. Or email me and I'll send you what I have. I hope no one else has already started. Noah

Re: PEG Parser

2011-01-30 Thread Andy Wingo
On Sat 29 Jan 2011 20:37, Noah Lavine writes: > I'm about halfway through porting peg.scm to use hygienic macros Super! I'll work on other bugs then :) Andy -- http://wingolog.org/

Re: PEG Parser

2011-02-06 Thread Noah Lavine
Hi, > However, I have a suspicion something odd is going on and this does > not contain all of the work it should from guile's repo. I ended up > having to use git cherry-pick instead of git rebase because I had made > a mistake when I first made my local peg branch. I checked out > origin/wip-mlu

Re: PEG Parser

2011-02-18 Thread Andy Wingo
On Wed 02 Feb 2011 01:26, Noah Lavine writes: > Here it is! All of the unhygienic syntax is gone, is a series of only > 20 commits. :-) The peg.test tests should all pass after each one of > these commits. Thanks! You've probably seen that I've applied this to wip-mlucy, which we should probabl

Re: PEG Parser

2011-02-23 Thread Noah Lavine
Hello, I tried looking at it a bit. First of all, your cleanups are awesome. :) Unfortunately, I need to ask for help in order to work on this more. I thought I would first move the code-generating functions to their own module. It seems like this should be a simple and obviously-correct transfor

Re: PEG Parser

2011-03-04 Thread Andy Wingo
On Wed 23 Feb 2011 16:10, Noah Lavine writes: > I need to ask for help in order to work on this more. I thought I > would first move the code-generating functions to their own module. It > seems like this should be a simple and obviously-correct > transformation, because I didn't change any code

Re: PEG Parser

2011-03-04 Thread Noah Lavine
Actually, I think I found a way to make it work. I had missed a macro that needed to be copied from one module to another. I made each module import the other, and that seemed to work all right. As soon as I have time, I hope to turn this into a patch series that splits the PEG module up into nice

Merged PEG parser

2013-01-16 Thread Andy Wingo
Hi, A brief note to say that I have merged the PEG parser written by Michael Lucy for GSOC 2010 to master. I just noticed that I did the rebase incorrectly: the commit http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=eee0877c3e6ade8f2fa243cfa696918451c67aff should have carried

PEG Parser Updates/Questions

2010-07-27 Thread Michael Lucy
I've officially eliminated the last define-macro expression. However, I get the feeling that things may not be exactly as desired. The original program made extensive use of functions in building the macros, and I originally tried to replace these with macros. This turned out to be a little diffi

Re: PEG Parser Updates/Questions

2010-07-27 Thread No Itisnt
On Wed, Jul 28, 2010 at 12:13 AM, Michael Lucy wrote: > Another question about module namespaces:  I have some syntax that I'd > like to be available to code generated by macros in my module, but > which I'd rather not export to the user (to avoid clobbering their > functions).  Is there a standa

Re: PEG Parser Updates/Questions

2010-07-27 Thread Michael Lucy
On Wed, Jul 28, 2010 at 12:41 AM, No Itisnt wrote: > On Wed, Jul 28, 2010 at 12:13 AM, Michael Lucy wrote: > >> Another question about module namespaces:  I have some syntax that I'd >> like to be available to code generated by macros in my module, but >> which I'd rather not export to the user (

Re: PEG Parser Updates/Questions

2010-08-05 Thread Michael Lucy
On Wed, Jul 28, 2010 at 12:13 AM, Michael Lucy wrote: > I've officially eliminated the last define-macro expression. > > However, I get the feeling that things may not be exactly as desired. > The original program made extensive use of functions in building the > macros, and I originally tried to

Re: PEG Parser Updates/Questions

2010-08-15 Thread Michael Lucy
On Fri, Aug 6, 2010 at 1:40 AM, Michael Lucy wrote: > On Wed, Jul 28, 2010 at 12:13 AM, Michael Lucy wrote: >> I've officially eliminated the last define-macro expression. >> >> However, I get the feeling that things may not be exactly as desired. >> The original program made extensive use of fun

Re: PEG Parser Updates/Questions

2010-08-21 Thread Andy Wingo
You see that the expansion of `(b '(1 2 3))' in the module `(d)' produced a reference to `c' -- but `c' is private in the `(a)' module. Barring the use of datum->syntax, syntax-case macros *scope free identifiers within the lexical conext and module in whic

Re: PEG Parser Updates/Questions

2010-08-29 Thread Phil
     #:use-module (a)) > >    (b '(1 2 3)) >     => 1 > > You see that the expansion of `(b '(1 2 3))' in the module `(d)' > produced a reference to `c' -- but `c' is private in the `(a)' > module. Barring the use of datum->syntax, syntax-case macros *scope free > identifiers within the lexical conext and module in which they > appear*. That's what "hygiene" is. > > Anyway, I hope to have time to poke this next week. I'm very much > looking forward to having a good PEG parser! > > Cheers, > > Andy > -- > http://wingolog.org/ > >

Re: PEG Parser Updates/Questions

2010-08-30 Thread Andy Wingo
Hi, On Sun 29 Aug 2010 00:45, Phil writes: > So is there a sort of ETA on when [PEG and other SoC projecsts] will > be part of Guile? Mmm, not really. I hope it will be soon, but I want to go through the code patch-by-patch, and that will take at least 3 or 4 hours, if everything goes well -- i

Re: GNU Guile PEG-parser

2012-02-07 Thread Noah Lavine
Hello, Thanks for emailing! I suppose I am the one to talk to, since I was the last one to work on it. I didn't make the PEG parsing syntax, but I would guess the reason there isn't a string syntax for ignore is that there's no conventional way to write it, but there is for the other PEG elements

Re: GNU Guile PEG-parser

2012-02-08 Thread Krister Svanlund
Hi, thanks for a quick response! I've actually found no PEG library that has a string syntax for the equivalent of ignore. I'm guessing most people are satisfied with just specifying another nonterminal and matching that one. Probably because it is seen as less ugly than extending on the formal de

Re: GNU Guile PEG-parser

2012-02-09 Thread Noah Lavine
st suggesting on what parts of PEG > internals to look at would be really useful. After thinking about it more, you have two choices. The easiest thing would be to parse each line (or extended line, if it ends with "\") with a PEG parser, and use your own logic for the blocks. Your p

Syntax-Case Macros for PEG Parser

2010-07-16 Thread Michael Lucy
I'm still working on this. I haven't dropped off the face of the earth; it's just taking a bit. The way I wrote the original define-macro macros, they called some functions (passing in symbol names) to generate blocks of code. This technique essentially depends on variable capture, so I can't re