Hacker News new | ask | show | jobs
by gizmo686 88 days ago
Even programs are just specifications by that standard. When you write a program in C, you are describing what an abstract C machine can do. When the C compiler turns that into a program it is free to do so in any way that is consistent with the abstract C machine.

If you look at what implementions modern compilers actually come up with, they often look quite different from what you would expect from the source code

1 comments

I don't disagree, so in a way, compilers are the specification that implement the standard? That doesn't feel right though.
Compilers are converters. There’s the abstract machine specified by the standard and there’s the real machine where the program will run (and there can be some layer in between). So compilers takes your program (which assumes the abstract machine) and builds the link between the abstract and the real.

If your program was a DSL for steering, the abstract machine will be the idea of steering wheel, while the machine could be a car without one. So a compiler would build the steering wheel, optionally adding power steering (optimization), and then tack the apparatus to steer for the given route.