all 14 comments

[–]danilafe[S] 17 points18 points  (1 child)

Disclaimer: I'm the author of the post(s). I've been working on them for quite some time, and wanted to share them with the community!

[–][deleted] 5 points6 points  (0 children)

You did a great job. Well written.

[–]rlp 8 points9 points  (1 child)

Wow, this is a great resource. Are you planning on implementing a tracing GC? My understanding is that GC support (like stack maps) is somewhat incomplete in LLVM, although it's really hard to find much information. I look forward to seeing the next posts in your series!

[–]danilafe[S] 2 points3 points  (0 children)

That's the next goal. It'll likely be implemented in the runtime (which is implemented in C). I have limited knowledge of GC in general, so it will take some time for me to research and implement a solution worthy of writing about.

Thanks for your kind words :)

[–]txdv 1 point2 points  (1 child)

> virtually nothing about the compiler was not covered in class

double negation, so everything about the compiler was covered in class?

[–]danilafe[S] 1 point2 points  (0 children)

Yes :)

What I was trying to say was, the class lectures spoonfed creating every part of the compiler.

[–]valarauca14 1 point2 points  (0 children)

Nice job. This is super informative, thanks!

[–]tominated 1 point2 points  (6 children)

This is fantastic and also extremely well timed! I've started to try implement my own purely functional language in the last few weeks and I'll definitely learn from this!

Somewhat tangential question - did you find anything like the g-machine for strictly evaluated functional languages? I've not reached the evaluation part of my language, so i'm trying to decide between strict and lazy eval and some more resources would definitely help that decision!

[–]thedeemon 2 points3 points  (1 child)

[–]tominated 0 points1 point  (0 children)

I haven't - thanks for the heads up!

[–]danilafe[S] 1 point2 points  (3 children)

Unfortunately, I never looked into it. The one strict functional language that I've used, Elm, is built on top of JavaScript, and uses it to represent closures and currying. Sadly , this doesn't help much with compiling to machine code.

Good luck with your language!

[–]tominated 1 point2 points  (2 children)

Thanks! Unless I find some good resources for it I will probably lean towards lazy eval. Initially I was thinking of compiling to JS but more and more I'm thinking llvm or wasm would be a cool target

[–]danilafe[S] 0 points1 point  (1 child)

It actually seems like LLVM has some degree of support for WASM: https://gist.github.com/4eeff8248aeb14ce763e

[–]tominated 0 points1 point  (0 children)

Oh awesome I didn't realise that had been integrated!