5 ms·
Micro C, Part 3: Generating LLVM
- cellularmitosis 7y agoThanks so much for writing this! Added to my list :) https://gist.github.com/cellularmitosis/1f55f9679f064bcff02905acb44ca510#tutorials https://gist.github.com/cellularmitosis/1f55f9679f064bcff029...
- winter_blue 7y agoThis is very cool!
- lioeters 7y ago"In this series, we will explore how to write a compiler for a small subset of C to LLVM in Haskell." Really enjoying this. For others, here's the series so far: Part 0: Introduction https://blog.josephmorag.com/posts/mcc0/ https://blog.josephmorag.com/posts/mcc0/ Part 1: Parsing https://blog.josephmorag.com/posts/mcc1/ https://blog.josephmorag.com/posts/mcc1/ Part 2: Semantic Analysis https://blog.josephmorag.com/posts/mcc2/ https://blog.josephmorag.com/posts/mcc2/ Part 3: Generating LLVM https://blog.josephmorag.com/posts/mcc3/ https://blog.josephmorag.com/posts/mcc3/
- ndesaulniers 7y agoAlways so happy to see folks making use of LLVM! It's all just Legos. I'm trying to work through/grok the MLIR tutorial now, myself. https://mlir.llvm.org/docs/Tutorials/Toy/Ch-1/ https://mlir.llvm.org/docs/Tutorials/Toy/Ch-1/
- helltone 7y agoI'd love a version of this written in plain C or Python. This is so much better than the Kaleidoscope tutorial. Haskell is a bit hard to grok tho.
- tonetheman 7y agoI am with you. Haskell is an brick wall of monads and other really hard words... I often wonder if Haskell is useful for anything and then I see articles like this... someone must be using it.
- yjftsjthsd-h 7y agoBoth pandoc and shellcheck are written in Haskell, so the world's getting mileage out of it. Granted, the author of shellcheck has mentioned that he might not have chosen Haskell if he could do it over, but I think that was mostly about it being hard to get contributors (take that with a grain of salt; I'm too lazy to look it up).
- thatfunkymunki 7y agohttps://engineering.fb.com/security/fighting-spam-with-haskell/ https://engineering.fb.com/security/fighting-spam-with-haske...
- codygman 7y ago> I am with you. Haskell is an brick wall of monads and other really hard words... I understand the feeling, that's why it's very necessary to either find a very good teaching resource. I'm currently reading "A Type of Programming" for fun and it kind of reminds me of "Why's poignant guide to Ruby in presentation (sadly sans artful illustrations)": https://atypeofprogramming.com/ https://atypeofprogramming.com/ (do yourself a favor and at least click to read the well-written intro ;) ) The caveat (because there usually is one) being that it's 720 pages long. That's another tradeoff though.. you either get something that gets you all the way from point A to point B and it's very long or you get something very dense that requires lots of hammock time to derive the intuition yourself. > I often wonder if Haskell is useful for anything Also, I'll note that I write Haskell for my day job to combat your though of "wonder if Haskell is useful for anything". > someone must be using it. Yep :)
- pjmlp 7y agoFor Python grab a copy of "Writing Interpreters and Compilers for the Raspberry Pi Using Python". And there is a C version of "Modern Compiler Implementation" as well.
- lldb_tuts 7y agoA bit off topic, but is there any guide/tutorial for using the LLDB API? The official doxygen-generated documentation doesn't seem to provide any hints about how to get started with the SB API.
- zetalemur 7y agoThat is very cool, but let me ask here: Is there a good resource, when it comes to code generation for register architectures? I know that this would be related to instruction selection and register allocation (where at some point you map an infinite register architecture - like LLVM - to a finite real-world machine), but I never found a nice example.
- bronxwhite 7y agohi