Hacker News new | ask | show | jobs
by gorgoiler 2235 days ago
Off topic: I teach compilers in high school and godbolt.org looks amazing, thanks for the link!
2 comments

Wow, really cool that there are high schools teaching compilers.
Yes, in Portuguese high schools you can do a technical education during the last three years (10 - 12), that gets you ready for the job market.

I did mine with focus on informatics during in the late 80's/early 90's.

Brief overview of three years subjects, besides the usual high school stuff.

Graphics programming, compilers, databases, MS-DOS, UNIX (Xenix back then), Networking (Novell Netware), OS development.

Languages that we got to use for different kinds of assignments during those three years, GW-Basic, Turbo Basic, Turbo Pascal 5.5, Turbo C 2.0/K&R C, Turbo C++ 1.0, Dbase III+, Clipper Summer '87 and OOP variant Clipper 5.x, 8086 and 68000 Assembly.

The high school I took it on still offers this, naturally updated to more modern stacks and teaching subjects.

For comparison, my Canadian high school offered a "Teach Yourself C++ in 30 Days" book that you could study for up to 10 hours in the optional Computers course. If you chose that module, by the end of the first class, you would be more knowledgeable on the subject than any teacher in the school.

(It was actually an excellent school; they just did not care about computing. Nevertheless, I'm quite jealous of those kids with such an interesting option available to them.)

Also when I was in high school in Canada in about 2001-2003, I ended up taking over the class and teaching C++ because I’d already learned enough of it in my spare time that knew it better than the teacher (he liked Pascal better).
Yes, unfortunately education varies a lot across the globe.

This is why we have Raspberry PIs now, even though such boards have existed for years.

It all started as an effort to reboot UK high school computing education that was stuck into teaching Office.

Wow that's some next level stuff. How do high schoolers cope with the topic?
Very well! Its extremely simplified: we introduce the hierarchy of high level Python, low level C, assembler mnemonics and binary machine code and look at examples of each.

But prior to that I have a few “virtual machines” that we use as compiler targets, where the VM is a robot finger that accepts the left right up down and press key commands, and the compilation step is to convert a string like HELLO into a series of robot commands.

So no branching. No labels or repeatable units of code. The example gets them warmed up to the idea of converting ideas in high levels to simpler code at lower levels, for simple machines to execute.

Towards the end we look at (but don’t dive too deep into) real world compilers. What does print(hello 2+3) look like in mach-O 64 assembler? Answer: erm quite a lot of gibberish but the ADDL is visible, and we can change it to SUBL and get “hello -1” to print :)

Personally, the hardest parts of compiling for me to understand were the steps after lexing. Moving through a grammar to actually do things. Having everything in Python helps this a lot, as you can see how parsing some source code is just a way of triggering other code to execute.

Apologies for the hand waving. I have a CS degree so I promise it’s not quite as vague as I make it out to be!