bugKawa - Bugs: bug #11858, internal compile error in...

 
 

bug #11858: internal compile error in recursive define-syntax

Submitter:  Steve Yegge <stevey>
Submitted:  Sat 05 Feb 2005 04:08:45 PM UTC
 
Category:  Code generation Severity:  3 - Normal
Item Group:  Compile-time exception Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Open
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       No canned response available

 

Sat 05 Feb 2005 04:08:45 PM UTC, original submission:  

The definitions of cond and case from Dyvbig's book
(http://www.scheme.com/tspl3/syntax.html#./syntax:h3)
both throw NullPointerExceptions when you try to
evaluate them in 1.7.91.

(define-syntax cond
  (lambda (x)
    (syntax-case x ()
      ((_ c1 c2 ...)
       (let f ((c1 (syntax c1)) (cmore (syntax (c2 ...))))
         (if (null? cmore)
             (syntax-case c1 (else =>)
               ((else e1 e2 ...) (syntax (begin e1 e2 ...)))
               ((e0) (syntax (let ((t e0)) (if t t))))
               ((e0 => e1) (syntax (let ((t e0)) (if t (e1 t)))))
               ((e0 e1 e2 ...) (syntax (if e0 (begin e1 e2 ...)))))
             (with-syntax ((rest (f (car cmore) (cdr cmore))))
               (syntax-case c1 (=>)
                 ((e0) (syntax (let ((t e0)) (if t t rest))))
                 ((e0 => e1) (syntax (let ((t e0)) (if t (e1 t) rest))))
                 ((e0 e1 e2 ...)
                  (syntax (if e0 (begin e1 e2 ...) rest)))))))))))

<stdin>:1311:3: internal compile error - caught java.lang.NullPointerException
java.lang.NullPointerException
at gnu.expr.Compilation.mangleName(Compilation.java:584)
at gnu.expr.Compilation.mangleName(Compilation.java:558)
at gnu.expr.LambdaExp.enterFunction(LambdaExp.java:1125)
at gnu.expr.LambdaExp.compileAsMethod(LambdaExp.java:1418)
at gnu.expr.LambdaExp.compile(LambdaExp.java:660)
at gnu.expr.Expression.compileNotePosition(Expression.java:98)
at gnu.expr.PrimProcedure.compileArgs(PrimProcedure.java:405)
at gnu.expr.PrimProcedure.compile(PrimProcedure.java:448)
at gnu.expr.PrimProcedure.compile(PrimProcedure.java:439)
at gnu.expr.ApplyExp.compile(ApplyExp.java:169)
at gnu.expr.ApplyExp.compile(ApplyExp.java:119)
at gnu.expr.Expression.compile(Expression.java:108)
at gnu.expr.BindingInitializer.emit(BindingInitializer.java:66)
at gnu.expr.Compilation.generateConstructor(Compilation.java:1115)
at gnu.expr.LambdaExp.compileEnd(LambdaExp.java:512)
at gnu.expr.Compilation.addClass(Compilation.java:1959)
at gnu.expr.Compilation.compile(Compilation.java:901)
at gnu.expr.ModuleExp.evalToClass(ModuleExp.java:77)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:196)
at kawa.Shell.run(Shell.java:231)
at kawa.Shell.run(Shell.java:177)
at kawa.Shell.run(Shell.java:164)
at kawa.Shell.run(Shell.java:151)
at kawa.repl.main(repl.java:672)

(the case example throws the same exception)

I haven't been able to narrow it down much.  Here's a very stripped-down version of the cond macro above, which throws the same exception:

(define-syntax nonsense
  (lambda (x)
    (syntax-case x ()
      ((_ c1 c2)
       (let f ((c1 (syntax c1)) (cmore (syntax (c2))))
         (with-syntax ((rest (f (car cmore) (cdr cmore))))
   (syntax (#t))))))))

Steve Yegge <stevey>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

Only logged-in users can vote.

 

 

 

 

No changes have been made to this item

Back to the top


Powered by Savane 3.9