News for hackers. Stuff that matters.
Re:Lessons learned building a toy compiler by lower on Friday July 07, 2017 @11:20AM (#14719011)
It's nice to have a small example of how to compile to LLVM, but the compiler is a bit more limited than what the blog post makes it appear.

It's not quite `a compiler for simply typed lambda calculus', but only for a small fragment without higher-order functions. One currently cannot write lambda terms that take functions as arguments.

I was curious how the compiler represents closures and manages memory, mainly because I'm looking for a small example of how to do garbage collection in LLVM. But it turns out that the parser doesn't allow function types yet and the compiler itself doesn't implement closures yet.

Re:Lessons learned building a toy compiler by jaseemabid on Friday July 07, 2017 @03:30PM (#14721342)
You are right, the compiler cannot handle much of higher order functions and closures yet. I have hinted how to do that with lambda lifting and closure conversion and I might get it working in the next few weeks. Maybe a part 2 for the blog post.
Re:Lessons learned building a toy compiler by lower on Saturday July 08, 2017 @07:03AM (#14724983)
Yeah, do it! :)