What is a compiler?
Why Compiler ?
Writing machine language-numeric codes is time consuming and tedious.
What are the defects of assembly language ?
– Not easy to write.
– Difficult to read and understand.
What is an Interpreter ?
What are some examples of interpreters ?
BASIC, LISP, used often in educational or development situations.
What is an Assemblers ?
What is a Linker ?
What is a Loader ?
What is a Preprocessor ?
What is an Editor ?
What is a debugger ?
What is a profile ?
What are the six phases of a compiler ?
– Scanner. – Parser. – Semantic Analyzer. – Source code optimizer. – Code generator. – Target Code Optimizer.
What are the three auxiliary components of a compiler ?
– Literal table.
– Symbol table.
– Error Handler.
What does a scanner do ?
What does a parser do ?
What does a semantic analyzer do ?
What does a source code optimizer do ?
What does a code generator do ?
What does a target code optimizer do ?
What are tokens ?
– A scanner collects characters into a token, as a value of an enumerated data type for tokens.
– May also preserve the string of characters or other derived information, such as name of identifier, value of a number token.
– A single global variable or an array of tokens.
What are syntax trees ?
– A standard pointer-based structure generated by parser.
– Each node represents information collect by parser or later, which maybe dynamically allocated or stored in symbol table.
– The node requires different attributes depending on kind of language structure, which may be represented as variable record.
What is a symbol table ?
– Keeps information associated with identifiers: function, variable, constants, and data types.
– Interacts with almost every phase of compiler.
– Access operation need to be constant-time.
– One or several hash tables are often used.
What is a lateral table ?
– Stores constants and strings, reducing size of program.
– Quick insertion and lookup are essential.