Live data from Hacker News

Introduction to Compilers and Language Design (2021)

dthain.github.io

31–40 of 58 posts

Re: Introduction to Compilers and Language Design (2021)

#32

[flagged]

https://news.ycombinator.com/threads?id=swordlucky666 - Sort of embarrassing that anyone vouched for this comment. Reading their history, they copy/paste the same comment or use an autogenerator (probably not an LLM, that'd produce better results) to generate comments like this one. Here's a comical one: https://news.ycombinator.com/item?id=48445529 > The discussion on Spanish traders set the standa raises interestin…

>(probably not an LLM, that'd produce better results)

The last 3 years was a paradigm shift. How do you know if a comment was generated by AI? If it's written Better than a human comment... if it's too good.

Re: Introduction to Compilers and Language Design (2021)

#33

Earlier quoted context omitted.

Probably by design. > This book offers a one semester introduction [...] enabling the reader to build a simple compiler that accepts a *C-like language*

Then it is really not about language design... I would rather recommend https://www.plai.org/

Why that book specifically?

Re: Introduction to Compilers and Language Design (2021)

#34

Earlier quoted context omitted.

>The people contributing to LLVM probably know everything down to assembly generation. they're truly incredible. Not really. I was webdev who then switched into compilers job with LLVM being foundation LLVM itself is huge, it is not trivial to be familiar with every it's areas/mechanisms, but writing not-complex passes, bug fixing, regression fixing does not require some fancy knowledge

If you don’t mind me asking, why and how did you make the switch? Going from webdev to compilers seems like a strong U turn that’s not easy to pull off, especially because the resources on compilers out there are extremely scarce

I've been working full time for like 3 yrs as C# dev + doing higher edu at weekends at the same time and I was about to decide thesis topic.

I've been searching for something challenging and found some very random post on programming forums about how compilers are hard etc and decided to give it a try.

I had kind of advantage that I accidentally had some significant amount of experience with handwritten parsers (at first job we were doing custom-markdown-like-language renderer as PoC or even when doing apprenticeship in high school I was rolling out csv parser instead of using libs, because... I'm not sure why, I probably didnt know how to use package manager or something)

I started reading about it a lot like dragon book (but it wasnt that useful tbh, too much math heavy)

or https://www.cs.cornell.edu/courses/cs6120/2020fa/self-guided...

or playlist like this: https://www.youtube.com/watch?v=wgHIkdUQbp0

And after year of jumping into it from time to time I've implemented small, custom-lang to LLVM IR to webassembly (via LLVM) compiler.

Then I had to find new job (we were very poorly paid) and I was interested in semiconductors industry because it was gaining traction (e.g chip war book) and it felt way more engineering oriented unlike web dev. Web dev tech decisions felt for me very religious, like fancy-conferences/blogposts oriented.

And since semiconductor industry often touches compilers, then that was opportunity for: better salary, interesting projects and in future transition to compilers

I've joined semico company as C# dev and then due to project cancellations/lay offs I managed to join compiler team and stress hard during first months since I had to learn new lang, new ecosystem, tools, approaches, techniques (e.g debugging) and only familiar thing was LLVM, which I was very beginner at.

but after that initial shock things were better, but I feel like I still need to improve my knowledge related to modern hardware, modern computer architecture, etc.

Debugging is very, very useful, cross-stack skill :)

Re: Introduction to Compilers and Language Design (2021)

#35

Just scannning the table of contents and I don't see any of the major topics of language design. It seems to be more like just "intro to compilers"

What books would you recommend for programming language design? What are the missing topics?

Types and Programming Languages (TAPL) by Benjamin C. Pierce. Basically IMO the main differentiator between languages is their type system. It’s basically table stakes now for programming languages to provide generics so users can write their own type-safe containers, and one simply cannot implement this without some theoretical background like TAPL.

In contrast you can easily skim Chapter 7, Semantic Analysis and realize this book gives extremely rudimentary information on type systems. Even if you were to design a dynamically typed language, this book doesn’t cover user-defined structs let alone modern essentials like user-defined sum types or closures.

Re: Introduction to Compilers and Language Design (2021)

#37

According to the introduction, the dragon book is at an advanced graduate level?

Dragon book is a weird one. While a classic, it only decently covers basics of the theory of computation, while only doing a brief run through the rest of compilers.

None of modern grad-level compiler topics are decently covered. The dragon is also not a very practical book.

Tiger book is a much better introductory read, balancing between practical and theoretical aspects.

Most truly advanced compiler topics are not really covered by any single book.

Re: Introduction to Compilers and Language Design (2021)

#38

Earlier quoted context omitted.

Probably by design. > This book offers a one semester introduction [...] enabling the reader to build a simple compiler that accepts a *C-like language*

Then it is really not about language design... I would rather recommend https://www.plai.org/

As a lisper, i like PLAI and all the other books from the same school: Lisp in small pieces and many others.

But they also felt kind of detached from realities of industrial languages and compilers.

These days Crafting Interpreters is probably the best suggestion.

Re: Introduction to Compilers and Language Design (2021)

#39
post #35

Earlier quoted context omitted.

What books would you recommend for programming language design? What are the missing topics?

Types and Programming Languages (TAPL) by Benjamin C. Pierce. Basically IMO the main differentiator between languages is their type system. It’s basically table stakes now for programming languages to provide generics so users can write their own type-safe containers, and one simply cannot implement this without some theoretical background like TAPL. In contrast you can easily skim Chapter 7, Semantic Analysis and re…

Programming language design is way weirder than any textbook would make you think.

For example, the first rule of language design is: "Sandwich Helix." https://xkcd.com/3003/

You'll also want to study how human language evolves, e.g. through "vernacularization," which is the laziness that drives people to create short words and phrases for ideas they need to communicate often.

You'll want to learn about the differing purposes of formal and informal constructions, and about why and how meaning itself drifts with time.

You'll want to learn why "DSL" is a nonsense word and what it means for a language to be embedded in more than one domain (e.g. English is both spoken and written).

Even a simpler discipline like API design will be incredibly enlightening. How do you get users to upgrade from an old version of your API to a new version? You need to learn how to guide people towards behaving how you want without any kind of coercion: the only power you have is the power to offer incentives. Can you figure out how to create a stable equilibrium of social behavior out of dreamed-up nonsense? If you remember nothing else remember this: every language design decision that now seems inevitable and set in stone, once seemed completely, pointlessly arbitrary. Survivorship bias is very tricky to reason about! Every attempt to create a language is "creating a 15th standard" (https://xkcd.com/927/), but you have to remember that that doesn't mean that it will fail. Every language that has ever succeeded has passed through this seemingly-impassable gate!

Post reply on HN