[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
internal iterative variables
- To: KAPLAN
- Subject: internal iterative variables
- From: TEITELMAN
- Date: Fri, 25 Mar 1977 23:08:19 -8000
- Date: 25 MAR 1977 2308-PST
not all of the informationyou want is available when you want it.
in fact puting in the EVAL form of i.s.opr took me about two weeks
because the situation is as follows
(1) you cant dwimify their operands until the
entire i.s. has been scanned and all the vars found
(2) but some i.s.oprs might contain BINDS etc. so is important
to expand the i.s.oprs before dwimifying any of them, however
(3) one cannot substitute in the operands into the i.s.opr
definitions until after dwiifying since othrwise any oerrors corrected
in the operands wont be seen int he oriiginal i.s.
(4) if i subsitute in beofe dwimifying, i cnt distinguish case where
user wirtes a $$VAL, thereby requiring a PROG in the
translation, or one comes as a result of an i.s.opr xpansion
such as collect.
now for the particulars of your requests:
if all you want to do is see if some other operrtor has been
seen prevously in the i.s., this is smple. there is
a variable called i.s.ptrs, which is a list of the i.s.oprs
seen. CAR of each entry is the lowercase version of the i.s.
(in the current lisp, this variable is called forptrs in case
you want to xperiment). so you can in fact determine if
a dfor has been seen at the time of xpanding a dbind.
the tail of the i.s. immediatel foollowing the operatr is also
available at eval time, as is the tail of the i.s. as of
the next operator, i.e. everything between the two tails
(after dwiifying which doesnt happen till later) will be
the body. the way you find this is
each element on i.s.ptrs is of the form
(opr tail1 tail2) where tail1 points into th i.s. as of
opr (however, (CAR of thattail may not be equal to opr,
e.g. CAR may be the uppercase version, opr the lower case,
or in the caseof an i.s.type opr will be the atm
i.s.type, but car of tail1 may be do, collect, etc.)
tail2 points to he next opr. so what you want is
cdr of tail1, i.e. (CDR (CADR (CAR LAST I.S.PTRS)))
note however that if you depend on this sort of thing,
then for your dfor, you will have to either handle the
cases (DFOR X INTEGER --) (DFOR (X INTEGER) --)
(DFOR X _ & INTEGER _ & --) etc. all yourself,
or else restrict yourself.
more to come