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?


Lynn Winebarger <owinebar@free-expression.org> writes:

>    Uh, why didn't you try looking at the source?  doesn't flex have an
> explicit skeleton?  (I know Bison does).

I did.  It has.  I needed some guidance from the output since I didn't
want to study all of flex's source before getting this hack running.

>     What do you mean by a "Scheme spec"?

The rules/grammar in Scheme syntax.

> > Now, *this* was a hack, but I think the idea of a dynamically
> > configurable table-based parser is great: you write the time critical
> > inner loops in C and crunch the rules from the grammar into tables.
> 
>    dynamically configurable?  I'm not sure what you mean by that - the
> tables are pretty fixed by the grammar specification.  Of course, you
> could replace the actions dynamically.

Exactly.  Given the scanner rules in Scheme syntax, there's a
procedure

  make-scanner-type RULES

which translates the rules into a flex input file, runs flex, extracts
the tables and builds a scanner type object from it.

Then you can make an actual scanner (with state information) with

  make-scanner TYPE PORT

and run flex with

  lex SCANNER

Dynamically configurable means that lex behaves in one way at one
instant and in another way the next (after I've given it a scanner
object of a different type).

If the port of the scanner skeleton is made well, all state
information will be incorporated into the scanner type and scanner
objects so that scanners of different types can run in parallel.

>     Actually, I spent my spring break reading Bison, and it was no picnic.
> That code is crufty.  The parser skeleton isn't so bad.  But I would not
> suggest translating Bison directly into Scheme.  Better to write your own
> generator, and wrap the Bison parser in a scheme function.

Yes, or write it in Scheme.

>    Anyway, I would also be interested in this, though I see no real need
> to port it to Scheme.  Bison can output just the tables if you want, and
> you could call the parser through scheme.

Well, if you're anyway going to rewrite the generator it's probably
easier to do it in Scheme.  It's also nice to be independent of bison.
And note that we *will* have to do a lot of rewriting in the skeleton.
There's always the risk that we'll be incompatible with the bison
generator after a while.  If it's written in Scheme, it will also be
easier to maintain.

>    I could work on it, but I'd need some kind of guile user's manual to
> see how it's supposed to work.

That would be great!

What do you mean with manual?  There's the guile-ref package.  Is that
enough?

I'll pack together what I have tomorrow and write down a few notes on
how it's supposed to work.  Then I'll mail it to you.


Are there any more people interested so that we can split the work?

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