3 ms·
The semantics of C aren't very well defined, there is a lot of ambiguity in the form of undefined and implementation defined behaviour. This ambiguity is often
by edwintorok 6y ago
The semantics of C aren't very well defined, there is a lot of ambiguity in the form of undefined and implementation defined behaviour. This ambiguity is often needed to build an efficient optimizing compiler.
When you have a higher level language with more accurately defined semantics, running it all through C would risk introducing undefined behaviour.
With an IR you can control and define the semantics more closely to what your language needs.
- ansible 6y agoI've got to wonder if any of the existing intermediate representations would be appropriate with other programming languages.
- steveklabnik 6y agoThis is true to varying degrees, you could say that LLVM-IR and Java bytecode are two examples of this in action.
- jfkebwjsbx 6y ago> When you have a higher level language with more accurately defined semantics, running it all through C would risk introducing undefined behaviour. No, it wouldn't. When you target C you need to write a proper backend for its abstract machine, rather than naively rewriting code, of course. The C abstract machine is a fine IR, specially the later editions of the standard.