On 02/20/2015 02:32 PM, Ali wrote:
Excuse my ignorance but then how is a compiler
written? I always thought
that you would need to know op codes and assembler to write a compiler. I.E.
you can't write and efficient compiler by using a high level language.
You have a front-end, which does the lexical work and translates the
program into some intermediate form, such as a tree. In the middle, you
have optimization and checking--and finally, you have the back end which
essentially emits code--but that doesn't necessarily imply that the
compiler author knows the numeric opcodes or the precise instruction
format. Many compiler backends feed into an existing assembler, which
puts it all together.
Knowing the numeric opcodes and instruction format isn't all that it
would seem to be. I never had much more than a passing familiarity with
the numeric opcodes of the CDC STAR--given that there was 8 bits for the
opcode and 8 more "modifier" bits, you arguably had a machine with
thousands of opcodes. What was hardest and very important was
committing to memory the *timings* of those instructions, within a
superscalar, segmented, pipelined vector architecture.
--Chuck