Author of the post here. AMA :)
I never took a course in writing compilers at University but have always been interested - where would be the best place to start for somebody interested in doing this? To dip their toes into the water if you will?
11–20 of 23 posts
Author of the post here. AMA :)
I never took a course in writing compilers at University but have always been interested - where would be the best place to start for somebody interested in doing this? To dip their toes into the water if you will?
Earlier quoted context omitted.
I think lexing is unnecessary with some methods, e.g. parser combinators and (I think) Might’s “Parsing with Derivatives”. And there are other tactics, like the other commenter mentioned.
There are alternatives, certainly. And lisp style languages are especially easy to parse without a lexer. I was just taking issue to the term "quintessential" being used. In a classical sense, the lexer comes first.
For instance, from a Chomsky's hierarchy of languages perspective lexing and parsing are simply language analysis at two different levels on the hierarchy with lexing focused on the "regular" language embedded within a larger context-free or context-sensitive language.
I love seeing articles like this... my compiler design course in college was one of my favorite. Also, one of the most useful. Parsers and lexers are useful in so many places besides just code compilers. With that said, I think there is one small issue in the article: > The quintessential first step in any compiler is parsing the source string into an Abstract Syntax Tree If there is a quintessential first step in wr…
I'll update the post with this feedback.Thank you.
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 bec…
Author of the post here. AMA :)
Hello there! Great post :) I never took a course in writing compilers at University but have always been interested - where would be the best place to start for somebody interested in doing this? To dip their toes into the water if you will?
1. Write a scheme in 48hrs in Haskell
2. Kaleidoscope tutorial by LLVM developers
I think the most underrated part is: "untyped lambda calculus is harder"
Earlier quoted context omitted.
Hello there! Great post :) I never took a course in writing compilers at University but have always been interested - where would be the best place to start for somebody interested in doing this? To dip their toes into the water if you will?
Just tinkering with the tools and writing some code helped me a lot more than the university course I had 6 years ago. There are several beginner friendly online resources now including 1. Write a scheme in 48hrs in Haskell 2. Kaleidoscope tutorial by LLVM developers 3. http://www.buildyourownlisp.com 4. http://createyourproglang.com
Perhaps before diving into FFI, you could write a small runtime library with the basic I/O you need (`readline` and `puts`, perhaps?)