bugKawa - Bugs: bug #14218, Exception compiling define-syntax

 
 

bug #14218: Exception compiling define-syntax

Submitted by:  Dean Ferreyra <dferreyra>
Submitted on:  Thu 18 Aug 2005 05:10:43 PM UTC  
 
Category: Code generationSeverity: 3 - Normal
Item Group: Feature RequestStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

Fri 10 Feb 2006 10:20:05 PM UTC, comment #3:

I've extended the interpreter to handle let and (most) lambda forms, so you can now use syntax-transforing functions in the same module as they are defined.

So this example now works.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 18 Aug 2005 06:40:04 PM UTC, comment #2:

Ah, I see. Sorry, I didn't recognize this as the same issue.

No need to bump priorities. When I added this, it was more so that it wouldn't be forgotten. But there's nothing to forget as it's a known issue.

Thanks!

Dean Ferreyra <dferreyra>
Thu 18 Aug 2005 06:24:30 PM UTC, comment #1:

Kawa has never supported procedural macros (as opposed to syntax-rules) being used in the same module as they are defined. The reason is that lambda expressions are always compiled, never interpreted, and there is no mechanism for compiling a modules in different pieces.

There are two possible solutions:
(1) Extend the interpreter to handle lambda and let forms.
(2) Implement a mechanism to split a module into sub-modules that can be compiled in stages. This could be done automatically or manually, using something like Common Lisp's eval-when.

Neither is planned for Kawa 1.8, but I had planned on doing (1) fairly soon. I think it would be fairly easy; it's mainly an issue of deciding on a suitable data structure for interpreted lexical environments (frames and closures). I can bump up the priority if you'd like.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu 18 Aug 2005 05:10:43 PM UTC, original submission:

We're getting an exception compiling macros and their uses, like this:

(module-static #t)

(define-syntax foo
(lambda (x)
(syntax #f)))

(foo)

I've copied in the exception below.

The problem seems to come from trying to use this style of macro in the same file it's defined. If I move the use of foo to a different file, everything compiles (and runs) fine.

----------------------------------------

% CLASSPATH=~/kawa/cvs/kawa-pure-build/kawa-1.8beta.jar java kawa.repl -C syn.scm
(compiling syn.scm)
java.lang.RuntimeException: internal error - class gnu.expr.LambdaExp.eval called
at gnu.expr.Expression.eval(Expression.java:15)
at gnu.expr.ApplyExp.eval(ApplyExp.java:59)
at kawa.lang.Translator.check_if_Syntax(Translator.java:218)
at kawa.lang.Translator.scanForm(Translator.java:896)
at gnu.kawa.lispexpr.LispLanguage.parse(LispLanguage.java:59)
at gnu.expr.Language.parse(Language.java:464)
at kawa.lang.CompileFile.read(CompileFile.java:37)
at kawa.lang.CompileFile.read(CompileFile.java:20)
at kawa.lang.CompileFile.compile_to_files(CompileFile.java:65)
at kawa.repl.processArgs(repl.java:407)
at kawa.repl.main(repl.java:728)
java.lang.RuntimeException: internal error - class gnu.expr.LambdaExp.eval called
at gnu.expr.Expression.eval(Expression.java:15)
at gnu.expr.ApplyExp.eval(ApplyExp.java:59)
at kawa.lang.Translator.check_if_Syntax(Translator.java:218)
at kawa.lang.Translator.rewrite_pair(Translator.java:280)
at kawa.lang.Translator.rewrite_with_position(Translator.java:806)
at kawa.lang.Translator.rewrite(Translator.java:568)
at kawa.lang.Translator.rewriteInBody(Translator.java:409)
at kawa.lang.Translator.rewriteBody(Translator.java:1069)
at kawa.lang.Translator.makeBody(Translator.java:1076)
at kawa.lang.Translator.finishModule(Translator.java:1192)
at gnu.kawa.lispexpr.LispLanguage.parse(LispLanguage.java:65)
at gnu.expr.Language.parse(Language.java:464)
at kawa.lang.CompileFile.read(CompileFile.java:37)
at kawa.lang.CompileFile.read(CompileFile.java:20)
at kawa.lang.CompileFile.compile_to_files(CompileFile.java:65)
at kawa.repl.processArgs(repl.java:407)
at kawa.repl.main(repl.java:728)
<unknown>:0: unable to evaluate macro for foo
syn.scm:7:1: unable to evaluate macro for foo

Dean Ferreyra <dferreyra>

 

(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):

 

 

Follow 6 latest changes.

Date Changed By Updated Field Previous Value => Replaced By
Fri 10 Feb 2006 10:20:05 PM UTCbothnerStatusPostponed=>Fixed
  Open/ClosedOpen=>Closed
Thu 18 Aug 2005 06:24:30 PM UTCbothnerCategoryScheme language=>Code generation
  Item GroupCompile-time exception=>Feature Request
  StatusNone=>Postponed
  Assigned toNone=>bothner

Back to the top


Powered by Savane 3.1-cleanup1