[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Splicing macro's & CGOL.



What you actually want is to setq READTABLE to a value which causes cgol
syntax to be read.  You certainly do not want to mess with the control
structure of whatever program happens to be reading forms.  You also
do not want to read ahead through all the cgol forms and buffer them back;
what if the program does TYIs in between its READs, or changes IBASE
or PACKAGE?  It is (of course) important that whatever way it is done
work interactively as well as for reading from files.

Neither the Lisp machine nor Maclisp has an extensible enough reader
to do this now.  It has been planned for a long time to do this in the
Lisp machine and I imagine would not be very hard.  One way would be
to make READ check (TYPEP READTABLE 'READTABLE) and if not
send a message to it.  A less general way would be to implement CGOL
using the normal reader rather than its own special parser; I believe
the Lisp machine reader has the flexibility to do this, using the
readtable compiler, although there might be subtleties I have overlooked.

Whatever cgol syntax means return to normal syntax would setq READTABLE
back to whatever it was before.

Of course, in many cases you would not switch syntax back and forth with
reader macros, but would put -*- Syntax:CGOL -*- at the front of your file,
which would bind READTABLE to the appropriate thing whenever anything
read from the file.  All the mechanisms for this already exist except
the above-mentioned hook in READ.