Live data from Hacker News

Advanced Compilers: Self-Guided Online Course

cs.cornell.edu

31–40 of 90 posts

Re: Advanced Compilers: Self-Guided Online Course

#32
post #19

Earlier quoted context omitted.

What do you mean exactly by "compilers"? Because the book features a chapter on how to compile source code to virtual machine byte code.

Most of the time when people talk about compiled languages/compilers, they mean languages that compile to native machine code, not languages that compile to a bytecode/run on a virtual machine.

Compiling to machine code rather than VM bytecode is a difference in degree rather than kind, and doing it well rather than naively is a deep topic.

Simple machine code generation with basic register allocation and evaluation which eagerly spills to the stack is not super hard. Producing fast code instead is a bottomless well.

Re: Advanced Compilers: Self-Guided Online Course

#34
post #20

I wish my school offered something even half good as this. I've seen it like 2 years ago and it is well prepared course. >CS 6120 is a PhD-level Cornell CS course by Adrian Sampson on programming language implementation. I just dont understand why is this "PhD level"

> I just dont understand why is this "PhD level" It would have been if the papers covered were closer to the state of the art. The most recent one is from 2015. However, this course would actually give you the background required to read more recent paper and work on compiler research, so calling it PhD level is not a huge stretch.

I mean a lot of programming language design goes back decades; it's better to focus a course on the basics that every language will have vs the most recent developments that haven't fully crystallized yet either.

Re: Advanced Compilers: Self-Guided Online Course

#36

Are there any courses on creating a new language, interpreter, and compiler from scratch? Like not using LLVM or similar to generate intermediate representation but to literally pick an ISA and, well, compile for it.

I compiled a basic C program and then read the output of GCC -S to see the assembly.

I used what I learned from GCC output Then I wrote a basic amd64 expression compiler with simple live ranges and linear register allocation and ANF (a normal form) for postorder AST traversal for code generation. It can only evaluate nested add and mul expressions.

https://github.com/samsquire/compiler or on replit: https://replit.com/@Chronological/Compiler3#main.py

Finding opcodes is a struggle but there is this website: https://www.felixcloutier.com/x86/ and https://www.cs.uaf.edu/2016/fall/cs301/lecture/09_28_machine... (the table at the bottom is really useful)

To learn code generation not targeting amd64, I wrote an imaginary assembly language and then wrote a switch based virtual machine and a compiler for it with a frontend that looks similar to javascript.

https://github.com/samsquire/multiversion-concurrency-contro... in ProgramParser.java, LanguageInterpreter.java, and LanguageInterpreterRunner.java for where main() is.

Re: Advanced Compilers: Self-Guided Online Course

#37

Are there any courses on creating a new language, interpreter, and compiler from scratch? Like not using LLVM or similar to generate intermediate representation but to literally pick an ISA and, well, compile for it.

Various books do this. Essentials of Compilation is a recent one: https://github.com/IUCompilerCourse/Essentials-of-Compilatio...

You can find a PDF and the associated course with a very minimal amount of following links.

If you are thinking of making your own language, it's also good to learn something about programming language theory, if you don't already. Many languages make mistakes that have been solved 25+ years ago. PLAI is good for that: https://www.plai.org/

Re: Advanced Compilers: Self-Guided Online Course

#38
post #20

Earlier quoted context omitted.

> I just dont understand why is this "PhD level" It would have been if the papers covered were closer to the state of the art. The most recent one is from 2015. However, this course would actually give you the background required to read more recent paper and work on compiler research, so calling it PhD level is not a huge stretch.

I mean a lot of programming language design goes back decades; it's better to focus a course on the basics that every language will have vs the most recent developments that haven't fully crystallized yet either.

There is a critical difference between programming language design and compiler design.

You are right when it comes to programming language design and somewhat wrong when it comes to compiler design.

If you are doing compiler research/development, you have to be familiar with the latest and greatest research because the margins for improving things are fairly slim. It’s usually fine to be not familiar with how things worked ~30 years ago.

For programming languages, you absolutely have to understand the foundations to do absolutely anything.

Re: Advanced Compilers: Self-Guided Online Course

#39
post #21
post #3

Are there equivalent 'Advanced Databases: The Self-Guided Online Course'? Andy Pavlo's CMU 15-721: Advanced Database Systems is similar, where you will hack on Postgres to implement a Foreign Data Wrapper (FDW)

Here you go: https://users.cs.utah.edu/~pandey/courses/cs6530/fall22/sche...

That class just uses my slides. It says so at the bottom of the page:

> The lecture slides used in the course are taken from Prof. Andy Pavlo's CMU 15-721 course

Just go to the source: https://15721.courses.cs.cmu.edu/spring2023/

Re: Advanced Compilers: Self-Guided Online Course

#40

Earlier quoted context omitted.

Precisely made for "creating a new language, interpreter, and compiler from scratch": http://craftinginterpreters.com

This does not cover compilers. I know because I specifically asked munificent (the author) about this before and he mentioned some other books to look at.

Yes, but it's still the most beginner-friendly book on implementing programming languages that I've ever seen. It covers VMs on the second part, and going from that to asm is not a huge leap.
Post reply on HN