Skip to content

Latest commit

 

History

History
182 lines (131 loc) · 5.39 KB

project.org_archive

File metadata and controls

182 lines (131 loc) · 5.39 KB

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

How could I use push and pop?

I’d like to be able to use x86’s capacities to improve generated code performance. I might have to push this off and just have a static stack pointer

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

Rewrite compiler to not use push and pop commands

Turns out there’s a new bug with let that will make using push and pop difficult: I’m manually rewriting the stack pointer to get function calls to work, but that messes up my variable references

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

Fix up parser to handle booleans

  • State “DONE” from “TODO” [2020-03-26 Thu 22:06]

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

Finish parsing let nodes

  • State “DONE” from “TODO” [2020-03-27 Fri 20:30]

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

Fix (cons (funcall) (any)) bug

  • State “DONE” from “TODO” [2020-04-23 Thu 21:38]

Trying to run something like this:

(compile (parse '(labels ((f (code (n) (if (= n 0) 1 (* n (app f (- n 1)))))))
                         (cons (app f 5) 6))))

Computes the factorial value correctly, but gives something that looks like a pointer for the cdr.

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

Should I have a node/app for regular function calls, and a node/lapp for direct lambda calls?

I think so. It’s kind of like differentiating between kapp and regular app.

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

Write a tortue test for the compiler thus far

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

Recursion bug

  • State “DONE” from [2020-04-03 Fri 00:05]

These break:

(compile (parse '(labels ((f0 (code (a) (+ a 1))) (f1 (code (b) (if (= b 0) (app f0 b) (app f1 (+ b 1)))))) (app f1 1))))

(compile (parse '(labels ((f0 (code (a) (+ a 1))) (f1 (code (b) (if (= b 0) (app f0 b) (let ((c (+ b 1))) (app f1 c)))))) (app f1 1))))

But these don’t:

(compile (parse '(labels ((f0 (code (a) (+ a 1))) (f1 (code (b) (if (= b 0) (app f0 b) (let ((c (+ b 1))) (+ c 1)))))) (app f1 1))))

(compile (parse '(labels ((f0 (code (a) (+ a 1))) (f1 (code (b) (if (= b 0) (app f0 b) (app f0 7))))) (app f1 1))))

(compile (parse '(labels ((f0 (code (a) (+ a 1)))) (let ((a 1)) (app f0 (+ a 1))))))

Oh, oops. That’s because the breaking ones are actually recursing infinitely.

Archived entries from file /Users/ashton/Wiersdorf/lambda-x86/project.org

Multi-value recursion bug

This works:

(compile (parse '(labels ((factorial (code (n) (if (= n 0) 1 (* n (app factorial (- n 1))))))) (app factorial 5))))

But this doesn’t:

(compile (parse '(labels ((factorial (code (n acc) (if (= n 0) acc (app factorial (- n 1) (* acc n)))))) (app factorial 5 1))))

I think it’s because I’m not using my stack right: instead of writing values to absolute places on the stack, I should try to use push and pop. Else, check my useage of the stack. See page 276 in the textbook for a detailed description.