levo

Programming

The stages of compilation and linking

  • 3 things to know
  • AS Unit 1
Start revising · £5/month

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.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

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

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A check requires a value.
presencerangeformat

Blank Blitz consolidates the facts

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

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

One byte is made up of 8 bits.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

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.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

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