←back to thread

143 points todsacerdoti | 5 comments | | HN request time: 0.331s | source
1. norir ◴[] No.43594752[source]
The hardest part of writing a compiler is designing a language. In my opinion, most compiler courses seem too fixated on the implementation details. The fact that this course targets x86 already misses the mark for me. Computers are very fast, there is no reason to start with a language that translates to asm. This is incidental complexity that distracts from language design.
replies(4): >>43594903 #>>43594913 #>>43594938 #>>43595205 #
2. wseqyrku ◴[] No.43594903[source]
> The hardest part of writing a compiler is designing a language.

That's a completely separate field. If you want to learn about language design you should study that, though it helps if you have some background on both to get started with either one.

3. dccsillag ◴[] No.43594913[source]
Hard disagree. There are a lot of implementation "details" that, if you want to do properly, are a lot of hard work and very much nontrivial. For example, do try to write a compiler with efficient incremental compilation, and especially one that does so while also having optimization passes. And that's just one example, most things in compiler implementations actually turn out to be fairly complex. And lots of features that modern languages support e.g. more powerful typesystems, trait/typeclass systems, etc. are also very very tricky.

While designing a language is by no means trivial, it generally really occupies just a very small fraction of the language/compiler developer's time. And, in most cases, the two things (language design + implementation details) have to walk hand-in-hand, since small changes to the language design can vastly improve the implementation end.

4. tiu ◴[] No.43594938[source]
Regarding the language design part, many universities I know of offer a {Advanced} Programming Languages class later on after a Compilers 101 class and that is where many of the topics like EBNF, Grammar Design along with different constructs are done.

Besides, for someone learning it for the first time I think designing a new language seems a bit difficult.

5. f1shy ◴[] No.43595205[source]
I disagree. First of all, you can write a compiler for any existing language. But second, inhave experience writing compilers and interpreters. For me the hardest was always to give good information/feedback on errors. Because the compiler cannot go ahead, means it is “confused” eliminates that confusion to help the user is very much non trivial.