Top all-time · #2063
Vidar Hokstad
Personal blog · hokstad.com · on HN as vidarhprogrammingsystems
Vidar Hokstad is a personal blog at hokstad.com about programming and systems. Since 2008, 36 different Hacker News readers have linked it 73 times, most often “Writing a compiler in Ruby, bottom up”. The last post was in 2016, but the archive is still widely read.
Often recommended · 14 of 30 sampled comments recommend it?
Why HN links it
HN readers link Vidar Hokstad's Ruby compiler series, valued for building a compiler incrementally, the way one writes an ordinary program, rather than starting with lexers and parsers. Semantic dictionary encoding is also cited.
- Recommended for · 14 comments
- Explains writing a compiler like any ordinary program, starting simple, so the design choices make sense.
Summarised by Claude from a sample of 30 HN comments that link here. Each comment is marked recommending, critical or neutral (citing without judging); how this works.
Most-linked posts?
- Writing a compiler in Ruby, bottom up9 people · 19 mentions · first linked 2008-09-30
- Writing a compiler in Ruby, bottom up (2008)5 people · 7 mentions · first linked 2015-07-17
- Writing a compiler in Ruby, bottom up5 people · 6 mentions · first linked 2013-08-15
- A Brief Introduction to Semantic Dictionary Encoding5 people · 5 mentions · first linked 2017-11-15
- Writing a compiler in Ruby, bottom up3 people · 5 mentions · first linked 2019-01-28
- /semantic-dictionary-encoding2 people · 3 mentions · first linked 2018-04-12
- Mini reviews of 19 Ruby template engines2 people · 2 mentions · first linked 2008-04-13
- /the-problem-with-compiling-ruby2 people · 2 mentions · first linked 2014-04-08
- Writing a compiler in Ruby from the bottom up2 people · 2 mentions · first linked 2008-04-09
- The Oberon-07 language report is 17 pages2 people · 2 mentions · first linked 2014-04-13
What Hacker News says?
Is this it? https://hokstad.com/semantic-dictionary-encoding
Comment linking /semantic-dictionary-encoding
on “Sneak Peek at WebAssembly Studio”Submitted Docker Development Patterns as a story · 251 points
HN discussionI highly recommend http://www.hokstad.com/compiler/ ; it talks about writing a compiler in a way that makes sense to me - writing it the way you write any other program, rather than throwing you straight in with lexers and parsers and never justifying why we need to do things this way.
Comment linking /compiler/
on “Kernel 101 – Let’s write a Kernel”Submitted Writing a compiler in Ruby, bottom up (2008) as a story · 89 points
HN discussionAlso cool to play around with are the various options that let GCC (and presumably LLVM) show you the various compilation stages of your C code. You can even spit out the C and resulting assembly side-by-side. I haven't had the time to play with this, but Part 4 of the excellent "Unix as IDE" series [1] goes into it and I'm sure there's more around the web. Another really fun way to get into the underlying assembler…
Comment linking /compiler
on “Learning C with gdb”Submitted Writing a compiler in Ruby, bottom up as a story · 62 points
HN discussionI could never understand why you have a parser as a separate thing when this was presented as an up-front decision. Reading this series of posts, where something like a traditional compiler architecture emerges in the same way that normal program architecture emerges via gradual refactoring, made it make a lot more sense to me: https://hokstad.com/compiler .
Comment linking /compiler
on “The Day I Fell in Love with Fuzzing”Submitted Some problems and solutions for compiling Ruby as a story · 9 points
HN discussionThe shelf thing annoys me greatly, but I don't want paper copies for the most part - I'm on a clearing-out-the-house spree, digitizing everything. But I'm concerned about what that does both for my relation to the media, and how it will change how my son gets introduced to things. So many of the ways I got introduced to books and music etc. was via what my parents had on the shelves or left out, or the radio the pla…
Comment linking /the-hidden-library
on “Calibre version 1.0 released”Submitted Writing a compiler in Ruby bottom up - step 10 as a story · 9 points
HN discussionIt seems to be gone from the repo, and doesn't seem to be worked on any more? A shame. AOT compiling Ruby is hard. I'm trying [1] [2]. Sorbet would be in a good position because part of the challenge of making it fast is that Ruby has a lot of semantics that are rarely used but that makes making compiled Ruby fast really hard. E.g. the bignum promotion adds overhead to every single operation unless you can prove inv…
Comment linking /compiler
on “Compiling Ruby to machine language”Submitted A Brief Introduction to Semantic Dictionary Encoding as a story · 8 points
HN discussionI couldn't disagree more. Syntax changes whether I can look at a page of code and get an idea of structure and which elements to focus attention on, or whether I need to read everything in detail. It doesn't matter that much when I have found a piece of code that I need to read and understand every detail of, but that is a tiny proportion of the amount of code reading I do - most of the time reading code is about gr…
Comment linking /how-to-implement-closures
on “The Unison language”Submitted Writing a compiler in Ruby bottom up - step 12 as a story · 8 points
HN discussionThat'd be me... Though with the caveat that my parser (part of this project[1] ) still has fairly substantial gaps, so it will grow, but certainly not to the size of MRI's parse.y. It's actually worse these days it turns out parse.y for Ruby is 11348 lines [2], though for fairness it's worth noting that it's written in a quite "linefeed heavy" style, and this includes providing a Ruby API to the parser. [1] http://h…
Comment linking /compiler
on “ANTLR Mega Tutorial”Submitted 5 simple ways to troubleshoot using Strace as a story · 5 points
HN discussionI followed this in the early 90s and had a lovely time. It helped that Turbo Pascal was my language of choice though and might not be quite so helpful now although Pascal is a pretty good pseudocode.. It's not the same but Vidar Hokstad has been writing a series for several years now in Ruby: http://www.hokstad.com/compiler/ .. and other resources aplenty: http://stackoverflow.com/a/1672/3951
Comment linking /compiler/
on “Let’s Build a Compiler (1995)”Submitted Eight Docker Development Patterns as a story · 3 points
HN discussionPost-2008 I'd really push http://www.hokstad.com/compiler . Writing a compiler in the same way you'd write an ordinary program, this was the first explanation where I actually understood the rationale for the choices being made.
Comment linking /compiler
on “Want to Write a Compiler? Read These Two Papers (2008)”Submitted Troubleshooting using Strace (2008) as a story · 3 points
HN discussion> http://www.hokstad.com/the-problem-with-compiling-ruby I wrote that one in frustration when working on my Ruby compiler project, actually, and I think there are reasonable solutions to all of them, and in fact you will find that most of them, possibly all are solved to various extents in either Smalltalk implementations or Self implementations. In particular the Self papers is an invaluable resource for anyone who…
Comment linking /the-problem-with-compiling-ruby
on “Ruby 2.1 Garbage Collection: ready for production”Submitted Mini reviews of 19 Ruby template engines as a story · 3 points
HN discussionI don't know Smalltalk well enough to say for sure, it's just my rather vague impression that Smalltalk is more compiler-friendly, likely based mostly on what I've read over the years about this, for example looking at: http://lambda-the-ultimate.org/node/2606 Ruby permits adding methods to individual objects; in Smalltalk, all methods reside in classes. In Ruby, it is practical and somewhat useful to add methods dy…
Comment linking /the-problem-with-compiling-ruby
on “Ruby 2.1 Garbage Collection: ready for production”Submitted Writing a compiler in Ruby from the bottom up as a story · 3 points
HN discussion> I was speaking metaphorically of Pascal being the LLVM of its day, more that it was a known base, portable, easy to explain and the first tool someone would reach for. Yeah, I got that. My point was that they did actually try to take the next step as well, but it was too early for that part. > I found this awesome post that covers SDE, http://hokstad.com/semantic-dictionary-encoding That's mine, in fact :) SDE doe…
Comment linking /semantic-dictionary-encoding
on “50 Years of Pascal”Submitted Why Rails is total overkill and why I love Rack as a story · 3 points
HN discussionI was speaking metaphorically of Pascal being the LLVM of its day, more that it was a known base, portable, easy to explain and the first tool someone would reach for. Templated IR code that has been LZ compressed sounds excellent, Thumb++ or uop buffer engine. It sounds like from the post below, that the instructions could even be pathologically the uop or VLIW instruction form and the SDE will effectively discover…
Comment linking /semantic-dictionary-encoding
on “50 Years of Pascal”Submitted URLs do not belong in the Views as a story · 3 points
HN discussionI'm a bit sad to see that it's the only article tagged: http://hokstad.com/semantic-dictionary-encoding Did you ever get around to exploring SDE's in a Ruby context?
Comment linking /semantic-dictionary-encoding
on “Oberon – The Overlooked Jewel [pdf]”Submitted Writing a compiler in Ruby, bottom up as a story · 2 points
HN discussion