Topic 13: Program construction

Cards (14)

  • A translator is a program that converts source code into object code
  • There are 3 types of translators which are Compilers, Interpreters and Assemblers
  • A compiler take a source code and translates it into object code all in one go
  • An advantage of compilers is that they run more quickly as it has already been translated, the code is optimised which means that they run faster and take up less space
  • A disadvantage of compilers is that the source code compiled on one platform will not run on another platform, The code has to be compiled again anytime the programmer makes changes to it
  • An interpreter converts source code into object one instruction at a time
  • An advantage of interpreters is that errors can be spotted easily, each code is executed as they are translated
  • A disadvantage of interpreters is that the code is not optimised, it takes more time as instructions are run one at a time
  • An assembler is a program that converts assembly language into machine code
  • The compilation process involves 4 stages which are lexical analysis, syntax analysis, semantic analysis and code generation
  • Lexical analysis is the removal of unnecessary spaces, line breaks or comments
  • Syntax analysis is the making sure that the rules of the programming language has been followed for each and every instruction
  • Semantic analysis is concerned with the relationship between instructions
  • Define semantic analysis

    Semantic analysis is concerned with the relationship between instructions