What are the 4 stages of program construction?
What happens during lexical analysis?
What is an identifier table?
Identifies all of the variables/ constants in the program and their data types
What is a reserved word table?
Identifies all of the words native to the programming language being used e.g. input, output
What happens during syntax analysis?
What happens during semantic analysis?
What happens during code generation and optimisation?
What are the aims of code optimisation?
What is a translator?
A program that converts source code (high level languages) into machine/object code.
What is a compiler?
adv:
- programs run quickly as its already been completely translated
- supplied as an executable file, therefore source code cannot be easily modified
disadv:
- code is translated as a whole, so enough memory must be available to store all the code at once
- cannot spot errors
- must be recompiled every time source code is changed
- object code produced is specific to processor’s architecture
What is an interpreter?
adv:
- instructions are executed as soon as they are translated
- requires less memory as instructions do not need to be stored for later use
- errors can be spotted quickly
disadv:
- interpreters run slower
- program has to be translated every time it is ran
- interpreters do not produce an executable file, so when being distributed the source code must be provided, which could be modified without permission
- interpreters do not optimise code
What is an assembler?
A program that converts assembly language into machine code.