levo

Programming

The stages of compilation and linking

  • 3 things to know
  • AS Unit 1

Overview

Main stages a compiler works through, symbol table and syntax error.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Process

Name the main stages a compiler works through.

Key term

What happens during code generation?

Key term

Why can a compiler never detect a logic error?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Name the main stages a compiler works through.

    Model answer

    A compiler carries out lexical analysis, syntax analysis, semantic analysis, code generation and code optimisation.

  2. 2

    What happens during lexical analysis?

    Model answer

    Lexical analysis reads the source character by character and groups it into tokens such as keywords, identifiers, operators and constants, discarding comments and unnecessary spaces.

  3. 3

    What is a token?

    Model answer

    A token is the smallest meaningful unit of source code recognised by a compiler, such as a keyword, an identifier, an operator or a literal value.

  4. 4

    What is the symbol table, and what is held in it?

    Model answer

    The symbol table is a store the compiler builds during translation, holding every identifier used in the program together with its data type, its scope and the memory address eventually allocated to it.

  5. 5

    What does syntax analysis check?

    Model answer

    Syntax analysis checks that the sequence of tokens obeys the grammar rules of the language, building a structure that represents the program and reporting any statement that breaks those rules.

  6. 6

    What is a syntax error? Give an example.

    Model answer

    A syntax error is a breach of the rules for writing statements in a language, such as a missing closing bracket or a misspelt keyword, and it stops the program being translated.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Systems Analysis and Development Approaches
Design, Development and Testing
Implementation and System Security
Programming

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A check requires a value.
presencerangeformat

Blank Blitz makes facts automatic

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

ANormal data is 12, which should be accepted.
BBoundary data is 1 and 50, which should be accepted.
C0 and 51, just outside the limits, should be rejected.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

One byte is made up of 8 bits.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Programming, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.