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

nested backquotes



   Posted-Date: Mon, 14 Nov 88 09:11:39 PST
   Date: Mon, 14 Nov 88 09:11:39 PST
   From: Don Cohen <donc@vaxa.isi.edu>

   I think I understand your description (I think you left out a quote or
   two in the last element).  Furthermore, I strongly suspect (but have
   not yet proven) that it is equivalent to mine.  If so, my explanation
   seems easier to understand.  The only problem was that you evidently
   did not understand what "matching" meant.  It was very simple and did
   NOT require expanding the inner backquotes.  Let me rephrase the model
   and see if you agree that it gives the same results as yours.  

   Pretend that comma (comma@) reads like quote - ,x = (COMMA x) except
   that an expression may not be in the scope of more commas than backquotes.
   Similarly, suppose that backquote reads as the symbol BACKQUOTE consed
   onto the next read.  So ``(a ,s ,',d ,,f `(,g)) reads as
   (BACKQUOTE BACKQUOTE a (COMMA s) (COMMA (QUOTE (COMMA d)))
	      (COMMA (COMMA f)) (BACKQUOTE ((COMMA g))))
   Now in order to evaluate that expression we find all forms that are
   in the scope of as many COMMAs as BACKQUOTEs.  We discard the leading
   BACKQUOTE and replace such expressions (along with the matching COMMAs)
   with their values.  In this case, the d and f are in the scope of 2 of 
   each.  The result is
   (BACKQUOTE a (COMMA s) (COMMA (QUOTE 4)) (COMMA 7) (BACKQUOTE ((COMMA g))))
   Evaluating this would similarly give something like
   (a 3 4 7 (BACKQUOTE ((COMMA g))))

   If you don't believe this model is equivalent please send me a 
   counterexample.  (The only thing I can see won't work is if something
   EVALUATES to a list containing the symbols BACKQUOTE or COMMA, and I
   think we can pretend that's impossible, even though it's precisely what
   I really WANTED to do!)

I believe that this model can be made to work, but you need additional
rules to explain what happens when ``(a ,,@f) expands to
(BACKQUOTE BACKQUOTE a (COMMA (COMMA@ f))).  At the very least you
must allow for COMMA having more than one subform.
--Guy