[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The utility of readmacros in converting infix expressions.
- Subject: Re: The utility of readmacros in converting infix expressions.
- From: SHRAGE at WHARTON-10 ( Jeffrey Shrager)
- Date: 27 Feb 1981 (Friday) 1833-EDT
I was hacking Franz yesterday and discovered several interesting things
about LISP in general;
Firstly, the purpose that I hoped to acheive was to define some major
subset of the APL syntax in LISP. The reason for such a game is neither
here nor there. I found an interesting application, albeit somewhat
special to the task at hand, for the upper/lower distinction that is
intrinsic in Franz (care of Unix). The Concept (and most key-paired APL
terminals) have the special APL functions in the shift position of the
normal characters. For example, cap-I yields IOTA, cap-R yields RHO, etc.
I simply defined readmacros that transformed cap-I into (iota ...) and
similar macros for most cap letters. Thus it was very simple to create
almost all the simple (non-overstrike) APL characters without interfering
at all with normal variable names. In fact, the result of this was that I
was able to basically type APL expressions directly to Franz and have them
Evaled as if it were APL by simply setting my terminal into APL mode.
A problem that I encountered is that there should really be better
read control in NORMAL LISP (ie, not someone's hacked version).
It is quite a problem to try and macro-hook infix operations because the
leftpart of the dyadic function has been eaten by the reader by the time
the readmacro is invoked. Typically this is resolved by simply writing
your own reader and parser. This would not be necessary if the macro could
get hold of the reader pointers and address the buffer (justread and to-be-
read) like an array.