Live data from Hacker News

Crafting “Crafting Interpreters”

journal.stuffwithstuff.com

41–50 of 76 posts

Re: Crafting “Crafting Interpreters”

#41
On creating the diagrams (buy scratch on pen and paper):

> I make mistakes sometimes, usually when lettering like “upvaluels” here. I fix that in Photoshop after scanning.

That's a pro tip, right there. All too often I get caught up in using the tool/program I'm in to do something completely, where it causes inefficient work loops. Part of that is realizing I'm stuck in a loop in my mind, and need to expand my horizons. Familiarity lets you know when to abandon one approach and use another (or at least when and where to shave off the rough bits you're subjecting yourself too). As an example, this doesn't happen to be in the shell. I'll happily take any textual output I'm given and process it through one or more tools to manipulate it, or if it comes to it, write a Perl one liner (or even convert that to a small Perl program with better syntax if it gets more complex) to manipulate and massage data, even if the purpose it to throw it back into the same program.

That may or may not be the most efficient way to tackle the problem, but it's a known solution, as opposed to not only not knowing how to to it in the tool I was using initially, but not knowing how to efficiently determine if it can even be done in that tool.

In this case, he's using pen and paper. He makes a mistake in the lettering after making sure the rest of the structure is correct, so he's got 90% of it correct and to his liking. He can start from scratch which is time consuming, or use some other physical medium tools (like white-out) to fix it, but it may not look quite right, or he can annotate the error with the fix and he can use a separate tool designed for quick and accurate visual manipulation (as opposed to creation, which it does but for many not as easily as with pen and paper) and layer a very effective fix in place afterwards.

Recognizing where and when you can do this effectively is likely one of the most beneficial skills you can train. It comes naturally with experience in an area, but being able to apply it to almost anything you do is a skill in itself.

Re: Crafting “Crafting Interpreters”

#42
post #19

This book has been a big help to me - thanks! > I liked the hand-drawn look. It furthered my meta-goal of making the material more approachable, more human. But I wanted to up the quality. I wanted them to be more intricate and contain more information. I wanted the drawings to be more detailed. Less margin doodles and more, well, illustrations. Maybe even some lowercase letters. This is one of the most unusual aspec…

I "hand-draw" graphics for technical articles, but on an iPad, which works well for me. Here's how I came to my current style, by experiment and reverse engineering: https://philipkiely.com/essays/useful_charts.html

Re: Crafting “Crafting Interpreters”

#43

> I used to do graphic design, and I have this weird tic where any time I see something that looks handwritten, I look for multiple instances of the same letter to see if they are different or if the design just used a handwriting font. It’s almost always a handwriting font and I die a little inside to see the illusion evaporate. Not a graphic designer, but I do the exact same thing and feel the exact same way... Hap…

I do this all the time. I'm satisfied that xkcd still appears to be hand-lettered.

Re: Crafting “Crafting Interpreters”

#45

Great writing. This should replace the syllabus for very many Comp Sci / Soft Eng "Intro to Compilers/Interpreters" courses as many do not come close to this level of detail.

I'm considering it for the course I teach! Although one thing that draws me is it doesn't have too much extraneous detail off the main narrative thread.

I currently use parts of the textbook Programming Language Pragmatics [1], one of the semi-standard texts used by a lot of universities (plus some of my own course notes). That book isn't really readable straight through though. It's 992 pages long, and some of the chapters get bogged down in a ton of coverage of the landscape of design and implementation choices. As a reference book that has some pros: you can look up something like looping constructs, and get a very detailed tour of how languages from Algol-68 through Modula-2 and C# have taken different design and implementation strategies. But that's not the same as reading something as your first introduction to a subject.

[1] https://www.cs.rochester.edu/~scott/pragmatics/

Re: Crafting “Crafting Interpreters”

#46

> I used to do graphic design, and I have this weird tic where any time I see something that looks handwritten, I look for multiple instances of the same letter to see if they are different or if the design just used a handwriting font. It’s almost always a handwriting font and I die a little inside to see the illusion evaporate. Not a graphic designer, but I do the exact same thing and feel the exact same way... Hap…

It's a fascinating video but what struck me the _most_ was the manual kerning of the handwriting after it was scanned. I know I'd have just copy/pasted all those identical echo() cells. Amazing to watch.

Yeah... it's one of those things where once I noticed the kerning was off I basically had to fix it. In many of the illustrations, I did a better job of writing with good spacing and then I didn't need to do as much fixup in Photoshop. But with the illustration I recorded for the video, I was so worried about making a mistake that I spread the letters out way too much.

Re: Crafting “Crafting Interpreters”

#47
post #41

On creating the diagrams (buy scratch on pen and paper): > I make mistakes sometimes, usually when lettering like “upvaluels” here. I fix that in Photoshop after scanning. That's a pro tip, right there. All too often I get caught up in using the tool/program I'm in to do something completely, where it causes inefficient work loops. Part of that is realizing I'm stuck in a loop in my mind, and need to expand my horizo…

> That's a pro tip, right there. All too often I get caught up in using the tool/program I'm in to do something completely, where it causes inefficient work loops.

I was caught in that loop with the first couple of chapters where I felt like the drawing itself had to be perfect and I would redraw them if I made a mistake. I got wrapped up in some sort of purist ideal (an affliction I am highly susceptible to).

Eventually I realized that all that matters is the final image, so I got better about taking advantage of Photoshop. Each line and letter in the diagram was still drawn by hand on paper, but sometimes I rearrange or fix mistakes in Photoshop.

Re: Crafting “Crafting Interpreters”

#48
post #45

Great writing. This should replace the syllabus for very many Comp Sci / Soft Eng "Intro to Compilers/Interpreters" courses as many do not come close to this level of detail.

I'm considering it for the course I teach! Although one thing that draws me is it doesn't have too much extraneous detail off the main narrative thread. I currently use parts of the textbook Programming Language Pragmatics [1], one of the semi-standard texts used by a lot of universities (plus some of my own course notes). That book isn't really readable straight through though. It's 992 pages long, and some of the c…

> I currently use parts of the textbook Programming Language Pragmatics

That was the first PL book I read. I really liked it, but you're right that it's like a survey of the entire landscape. For a first book, I personally like getting a single guided tour so that I feel like I'm going somewhere and not just looking at everything from a distance.

Re: Crafting “Crafting Interpreters”

#49
post #30

How does this work? Spending 4 years, full time from what it seems, on a book with a (let's face it) niche audience. While having (again, it seems from the post) a family with children, living in a first world country, flying regularly (I'm using this as a shortcut for 'getting out of the house for things more expensive than a hike in the woods'). So that's an opportunity cost of 200k for a book that would a runaway…

> Spending 4 years, full time from what it seems, on a book with a (let's face it) niche audience.&

Four years, yes, but much less than full time. Usually around an hour a day, often less.

I work full time at Google and the book was a (very involved) hobby.

> that's an opportunity cost of 200k*

Yes, there's definitely a financial opportunity cost. But when I see someone working a job they hate eight hours a day, I often wonder what the satisfaction opportunity cost of that is. What could they be doing instead that would be more meaningful to them?

I'm unlikely to make enough money from the book to justify the time (though my first book made me much more than I expected), but I do think it will bring enough other rewards to be worth the time.

Re: Crafting “Crafting Interpreters”

#50
post #30

How does this work? Spending 4 years, full time from what it seems, on a book with a (let's face it) niche audience. While having (again, it seems from the post) a family with children, living in a first world country, flying regularly (I'm using this as a shortcut for 'getting out of the house for things more expensive than a hike in the woods'). So that's an opportunity cost of 200k for a book that would a runaway…

> Spending 4 years, full time from what it seems, on a book with a (let's face it) niche audience.& Four years, yes, but much less than full time. Usually around an hour a day, often less. I work full time at Google and the book was a (very involved) hobby. > that's an opportunity cost of 200k* Yes, there's definitely a financial opportunity cost. But when I see someone working a job they hate eight hours a day, I of…

Oh I understood you worked on it full time, yeah I understand writing one as a hobby project. Thanks for replying.
Post reply on HN