This is the mail archive of the
guile@sources.redhat.com
mailing list for the Guile project.
Re: Guile scanners and parsers
- To: Ian Grant <Ian dot Grant at cl dot cam dot ac dot uk>
- Subject: Re: Guile scanners and parsers
- From: Jost Boekemeier <jostobfe at linux dot zrz dot TU-Berlin dot DE>
- Date: 14 Jul 2000 12:37:20 +0200
- Cc: djurfeldt at nada dot kth dot se, guile at sourceware dot cygnus dot com
- References: <E13Czpe-0007lH-00@wisbech.cl.cam.ac.uk>
Ian Grant <Ian.Grant@cl.cam.ac.uk> 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.
Jost