Comment by t-3
1 year ago
After learning asm, teach compilers and have them think about how to generate code stupidly, then think about how to generate efficient code. If you don't want people thinking about the stack, just teach them RISC rather than x86.
So you think people should start their programming journey by writing a compiler in assembly? What exactly should it compile, if they haven't learned any other language?
It's relatively common is university CS courses to build a compiler after the basic intro and architecture courses. It's one of the simpler projects (yes, really, compilers are rather simple, optimization is the hard part) that involves a lot high-level concepts and exposes a lot of the thought behind things otherwise obscure. A compiler for a simple 4-function calculator is enough to start with, then higher-level constructs can be added easily while introducing them.
In my university, compilers were a third-year course. And they're anything but simple - even the most well solved part of them, parsing, used to be a research-level problem until fairly recently. To build even a simple non-optimizing compiler you have to understand a whole lot of other fundamentals, such as various data structures, that are much, much harder to understand in assembler then in any higher level language, even C.