This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GSOC | Extending Common Lisp support


On 24 April 2012 08:30, Jamison Hope <jrh@theptrgroup.com> wrote:
> Congratulations to you, sir!

Thank you :)

> We already touched on this a little bit in a previous message, but: as
> you're working on this, I encourage you to strive to make things as
> broadly reusable as possible.

I had noticed these things, I already tried refactoring getNamedType,
but it's not as straightforward as I initially thought. I'm going to
try and get DECLARE's scoping working first, before sorting this out.

================

Following on from the DECLARE discussion, I tried creating let
expressions for DECLARE'd bindings.

Here's my latest approach in processTypeDeclArgs along with what I
think each line is doing:

for each declaration:

        letStart(); // create a new lexical environment
        ReferenceExp ref = new ReferenceExp(decl); // decl the x in a
(declare (integer x))
        letVariable(decl, ref); // push x into this new lexical environment
        this.lexical.push(decl); // not sure why this is necessary,
Jamison's advice (I think!)
        letEnter(); // push this let expr in the lexical environment
        decl.setType(this.exp2Type((Pair) typeList)); // set the type
of x in this lexical environment
        decl.setFlag(Declaration.TYPE_SPECIFIED);
        letexp = letDone(rewrite_body(body)); // this is dodgy, seems
necessary to finish up a LET

I'm aware that I'm handling the case where decl might already be in
the scope and I'll shadow it, but I'm trying to sort out the simpler
case first.

I'm also aware this creates unnecessary lexical scopes in the case of
DECLARE being the first form after DEFUN, fixing that would require
doing something different in the let syntax rewriter for CL (i.e.
processing declarations)....

However, with this:

(defun test (x) (if (= 1 1) x (let ((y 10)) (declare (integer x)) (+ x 1))))

I get a
internal compile error - caught java.lang.Error: attempting to push
dead variable
gnu.bytecode.CodeAttr.emitLoad(CodeAttr.java:1348)
gnu.expr.Declaration.load(Declaration.java:391)
...

Any clues on what I'm doing wrong now? I don't fully understand this
error, nor why it's occurred. I realise this all a bit "out of the
blue", just posting to see if anyone can point me in the right
direction.

Code attached for context, not serious consideration.

Thanks for your time,
Charlie.

Attachment: Lisp2Compilation.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]