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

 
 

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

Submitted by:  Steve Yegge <stevey>
Submitted on:  Sat 05 Feb 2005 04:08:45 PM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: Compile-time exceptionStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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 File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

No Changes Have Been Made to This Item

Back to the top


Powered by Savane 3.1-cleanup