This is the mail archive of the guile@cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: A generic reader for Guile?



Mikael Djurfeldt <mdj@mdj-pc.nada.kth.se> writes:

 > I was referring to the metasyntactical style of the specification.
 > 
 > Instead of writing
 > 
 >      ...
 >      exp:      NUM                { $$ = $1;         }
 >              | exp '+' exp        { $$ = $1 + $3;    }
 >      ;
 >      ...
 > 
 > you write
 > 
 >      ...
 >      (exp ((NUM)         (lambda (x) x))
 >           ((exp #\+ exp) (lambda (x y) (+ x y))))
 >      ...
 > 
 > or something like that.  (It may be interesting to ponder if there is
 > some other way to specify the action than with lamdas's which could
 > achieve higher performance.)

Bigloo has this.  Take a look at
http://kaolin.unice.fr/bigloo/bigloo.html, and in particular 
http://kaolin.unice.fr/bigloo/Doc/bigloo.html, sections
4.8 Regular parsing and 4.9 Lalr(1) parsing.

I wrote a pascal parser using it which worked well for the purpose of
bridging the gap btw the pascal code I had on hand and what p2c could
handle.

Bigloo's stuff is all written in scheme.  I'd expect the code to be
easier to work with than flex & bison.  The actual code might even
just run in guile.  You also might find a simple central engine that
you can code in C to get full C performance.  BTW, it also comes with
a C header file parser it uses for building scheme interfaces to C
code.  This might also be useful for guile.

Also, please, please, please look at Bigloo's interface & preserve it
unless you have extremely good reasons for "improving" it.  I think
that compatibility with prior art is *very* important and should only
be sacrificed for *large* gains on other fronts.

-- 
Harvey J. Stein
Bloomberg LP
hjstein@bfr.co.il

--PAA15703.931437350/blinky.bfr.co.il--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]