[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison for CL?
My hacked version of Bison is in /../skef/usr/skef/newbison/. Maybe
by now there's a new, diverged version from FSF, so if you want the
latest non-Lisp features, someone will have to do some merging. Also,
if one was up to it, the bison.simple.lisp code could be made a little
neater, or something. I've written no documentation on what I've done
or how to use it, but someone could start from what I'll type here and
flesh it out.
The new switch to get it to generate Lisp code is -L. To specify the
package into which the Lisp code should go, specify -P <package>. For
example, for my compiler, I've got this in a makefile:
bison -vL -P SAL gram.y
The above generates gram.tab.lisp from the grammar in
/../x/usr/skef/sal/gram.y, putting the code in the SAL package.
For example code as to how to hook things up to Lisp, check out
/../skef/usr/skef/sal/lex.lisp (which uses the Bison-generated constants
for symbols and keywords). The whole thing gets called like this:
(set-up-lexer stream) ; this is defined in lex.lisp
(yyparse) ; this is defined in gram.tab.lisp
Good luck. Let me know if something comes of this. It might also be
worth someone's time someday to try to get FSF to pick up these changes.
I got no response last time I asked them if they were interested. Maybe
with some real documentation something would happen.