The lexical analyser (or scanner): reads the source program’s text (one character at a time); and returns a sequence of tokens to send to the next phase.  Tokens are symbolic names for the lexical elements of the source language
 analyses the syntactic structure of the source program for valid syntax input to a parser is the sequence of output tokens from the lexical analyser  It attempts to apply the rules that define the syntax of the language on the sequence of tokens
 The three analysis phases of a compiler must be able to deal with errors in the source program.  On detecting an error a compiler should ideally: report the error in a helpful way, and continue processing to look for further errors.
 Attempts to improve the time and space requirements of a program, i.e., makes a smaller or faster or both.  Example optimisations include: -constant folding (e.g., replacing 3+7 with 10); -eliminating unreachable code
 The final task of the compiler is to generate code for a specific machine. In this phase we need to consider such  The output from this phase is usually programs in machine language or assembly language or code for a virtual machine.
What things may be considered during code generation
 Instruction selection: The machine language instr' to use  Instr' scheduling: The order to put those instr' Register allocation: The allocation of variables to processor registers Debug data generation if required so the code can be debugged
no never, Instead, a virtual machine is supplied that takes the intermediate language as its machine language, and interpret the intermediate code (much faster than it would be able to interpret a high-level language)
Give examples of some Hybrid Implementation Systems languages
 compile programs to an intermediate language intermediate language is loaded into memory  segments/subprograms are translated into machine code just before its execution (or when they are called) The machine code is kept for subsequent calls