This is the mail archive of the 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: Guile scanners and parsers

Ian Grant <> writes:

> I would be interested to see the work you did porting the flex
> scanner driver to guile.

Yes, I'd like to see the code, too.

> I'm curious as to why you did it though: is there a great deal to be
> gained by being able to change the scanner without recompiling C
> code?  How often will people want to change scanners?

Hmm, every time you switch to another module, I think.  So that
clients of Ian's tcl->scheme module can and will use a different
reader than the "normal" scheme reader.

From bigloo's documentation:

     bigloo procedure: read/rp regular-parser input-port 

     The first argument is a regular parser and the second a Scheme
     port. This way of reading is almost the same as the Lex's
     one. The reader tries to match the longest input, from the stream
     pointed to by input-port, with one of several regular expressions
     contained in regular-parser. If many rules match, the reader
     takes the first one defined in the grammar. When the regular rule
     has been found the corresponding Scheme expression is evaluated.

     remark: The traditional read Scheme function is implemented as: 

     (define-inline (read port)
        (read/rp scheme-grammar port))

Bigloo's read/rp is written in Scheme and should be portable.


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