robert-strandh / SICL

A fresh implementation of Common Lisp
Other
1.07k stars 79 forks source link

Issue parsing (macrolet ((with-element-output (() &body body) ...) #105

Closed drmeister closed 3 years ago

drmeister commented 6 years ago

I ran into this while trying to compile yason.

https://github.com/hanshuebner/yason/blob/gh-pages/encode.lisp#L68

This is the backtrace from Clasp:

128 (CALL-WITH-VARIABLE-BOUND CORE:STACK-TOP-HINT 668 #) 129 (UNIVERSAL-ERROR-HANDLER NIL CLEAVIR-CODE-UTILITIES:MALFORMED-LAMBDA-LIST-PATTERN NIL) 130 (ERROR CLEAVIR-CODE-UTILITIES:MALFORMED-LAMBDA-LIST-PATTERN) 131 (PARSE-PATTERN NIL) 132 (PARSE-ALL-REQUIRED (NIL &BODY YASON::BODY) 0 1 #) 133 (LAMBDA 3 :PROPER) 134 (PARSE-MACRO-LAMBDA-LIST (NIL &BODY YASON::BODY)) 135 (PARSE-MACRO YASON::WITH-ELEMENT-OUTPUT (NIL &BODY YASON::BODY) ((CORE:BACKQUOTE-APPEND (LIST 'PROGN) (LIST (CORE:BACKQUOTE-APPEND (LIST 'COND) (LIST (CORE:BACKQUOTE-APPEND (LIST '#:PRINTED196374) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-DELIMITER) (LIST '#\,) (LIST 'STREAM) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'T) (LIST (CORE:BACKQUOTE-APPEND (LIST 'SETF) (LIST '#:PRINTED196374) (LIST 'T) 'NIL)) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-INDENTATION) (LIST 'STREAM) 'NIL)) YASON::BODY 'NIL)) #<LEXICAL-VARIABLE #:PRINTED196374 # @0x116783ed9>) 136 (EXPANDER (YASON::WITH-ELEMENT-OUTPUT (NIL &BODY YASON::BODY) (CORE:BACKQUOTE-APPEND (LIST 'PROGN) (LIST (CORE:BACKQUOTE-APPEND (LIST 'COND) (LIST (CORE:BACKQUOTE-APPEND (LIST '#:PRINTED196374) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-DELIMITER) (LIST '#\,) (LIST 'STREAM) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'T) (LIST (CORE:BACKQUOTE-APPEND (LIST 'SETF) (LIST '#:PRINTED196374) (LIST 'T) 'NIL)) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-INDENTATION) (LIST 'STREAM) 'NIL)) YASON::BODY 'NIL)) #<LEXICAL-VARIABLE #:PRINTED196374 # @0x116783ed9>) 137 ((METHOD CONVERT-SPECIAL ((EQL 'MACROLET) T T T)) #<VA-LIST: (MACROLET (MACROLET ((YASON::WITH-ELEMENT-OUTPUT (NIL &BODY YASON::BODY) (CORE:BACKQUOTE-APPEND (LIST 'PROGN) (LIST (CORE:BACKQUOTE-APPEND (LIST 'COND) (LIST (CORE:BACKQUOTE-APPEND (LIST '#:PRINTED196374) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-DELIMITER) (LIST '#\,) (LIST 'STREAM) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'T) (LIST (CORE:BACKQUOTE-APPEND (LIST 'SETF) (LIST '#:PRINTED196374) (LIST 'T) 'NIL)) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-INDENTATION) (LIST 'STREAM) 'NIL)) YASON::BODY 'NIL))) (MAPHASH (LAMBDA (YASON::KEY YASON::VALUE) (YASON::WITH-ELEMENT-OUTPUT NIL (YASON::ENCODE-KEY/VALUE YASON::KEY YASON::VALUE STREAM))) YASON::OBJECT) YASON::OBJECT) #<LEXICAL-VARIABLE #:PRINTED196374 # @0x116783ed9> #)> NIL) 138 (LAMBDA) 139 ((METHOD CONVERT-SPECIAL (AROUND) (T T T T)) #<VA-LIST: (MACROLET (MACROLET ((YASON::WITH-ELEMENT-OUTPUT (NIL &BODY YASON::BODY) (CORE:BACKQUOTE-APPEND (LIST 'PROGN) (LIST (CORE:BACKQUOTE-APPEND (LIST 'COND) (LIST (CORE:BACKQUOTE-APPEND (LIST '#:PRINTED196374) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-DELIMITER) (LIST '#\,) (LIST 'STREAM) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'T) (LIST (CORE:BACKQUOTE-APPEND (LIST 'SETF) (LIST '#:PRINTED196374) (LIST 'T) 'NIL)) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-INDENTATION) (LIST 'STREAM) 'NIL)) YASON::BODY 'NIL))) (MAPHASH (LAMBDA (YASON::KEY YASON::VALUE) (YASON::WITH-ELEMENT-OUTPUT NIL (YASON::ENCODE-KEY/VALUE YASON::KEY YASON::VALUE STREAM))) YASON::OBJECT) YASON::OBJECT) #<LEXICAL-VARIABLE #:PRINTED196374 # @0x116783ed9> #)> (#<FUNCTION (METHOD CLEAVIR-GENERATE-AST:CONVERT-SPECIAL ((EQL 'MACROLET) T T T))>)) 140 (COMBINE-METHOD-FUNCTIONS.LAMBDA #<VA-LIST: (MACROLET (MACROLET ((YASON::WITH-ELEMENT-OUTPUT (NIL &BODY YASON::BODY) (CORE:BACKQUOTE-APPEND (LIST 'PROGN) (LIST (CORE:BACKQUOTE-APPEND (LIST 'COND) (LIST (CORE:BACKQUOTE-APPEND (LIST '#:PRINTED196374) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-DELIMITER) (LIST '#\,) (LIST 'STREAM) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'T) (LIST (CORE:BACKQUOTE-APPEND (LIST 'SETF) (LIST '#:PRINTED196374) (LIST 'T) 'NIL)) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-INDENTATION) (LIST 'STREAM) 'NIL)) YASON::BODY 'NIL))) (MAPHASH (LAMBDA (YASON::KEY YASON::VALUE) (YASON::WITH-ELEMENT-OUTPUT NIL (YASON::ENCODE-KEY/VALUE YASON::KEY YASON::VALUE STREAM))) YASON::OBJECT) YASON::OBJECT) #<LEXICAL-VARIABLE #:PRINTED196374 # @0x116783ed9> #)> NIL) 141 CONVERT-SPECIAL 142 ((METHOD CONVERT-FORM (T SPECIAL-OPERATOR-INFO T T)) #<VA-LIST: ((MACROLET ((YASON::WITH-ELEMENT-OUTPUT (NIL &BODY YASON::BODY) (CORE:BACKQUOTE-APPEND (LIST 'PROGN) (LIST (CORE:BACKQUOTE-APPEND (LIST 'COND) (LIST (CORE:BACKQUOTE-APPEND (LIST '#:PRINTED196374) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-DELIMITER) (LIST '#\,) (LIST 'STREAM) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'T) (LIST (CORE:BACKQUOTE-APPEND (LIST 'SETF) (LIST '#:PRINTED196374) (LIST 'T) 'NIL)) 'NIL)) 'NIL)) (LIST (CORE:BACKQUOTE-APPEND (LIST 'YASON::WRITE-INDENTATION) (LIST 'STREAM) 'NIL)) YASON::BODY 'NIL))) (MAPHASH (LAMBDA (YASON::KEY YASON::VALUE) (YASON::WITH-ELEMENT-OUTPUT NIL (YASON::ENCODE-KEY/VALUE YASON::KEY YASON::VALUE STREAM))) YASON::OBJECT) YASON::OBJECT) # #<LEXICAL-VARIABLE #:PRINTED196374 # @0x116783ed9> #)> NIL)

Bike commented 3 years ago

This bug predates the generate-AST to CST-to-AST switchover. It has long since been fixed.