Question | Answer |
What is the purpose of a translator? | To convert source code into object code (machine code) |
What is an opcode? | A particular binary operation that a computer can carry out, e.g. additional, division |
What is a mnemonic? | Key words representing opcodes, e.g. ADD, SUB, MULT, DIV |
What table is used to convert mnemonics to opcodes? | The lookup table |
What is the difference between a compiler and an interpreter? | A compiler translates a program's source code into object code all at once. An interpreter translates a programs source code into object code one line at a time, running each line as soon as it is translated |
What are the three phases of compilation? | 1) Lexical analysis 2) Syntax analysis 3) Code generation and optimisation |
What is the process of lexical analysis? | 1) All comments and whitespace are removed 2) Simple error checking is performed 3) Tokens are created from the input characters 4) Identifiers (variable names) are placed in a symbol table |
What are tokens? | Symbolic representations of the input characters. They are usually represented by numbers |
What is it called when there are a specific group of characters that represent a token? | A lexeme |
What is the slowest phase of compilation? | Lexical analysis |
What is the purpose of syntax analysis? | To determine whether the sequence of input characters, symbols, items and tokens form a valid sequence in the language as defined by BNF or syntax diagrams |
Which semantic checks are carried out during syntax analysis? | 1) Label checks 2) Flow of control checks (Makes sure statements are used in the correct place and order) 3) Declaration checks (Makes sure all variables have been properly declared) |
Want to create your own Flashcards for free with GoConqr? Learn more.