2.2.14

Lexical Analysis

Test yourself on Lexical Analysis

Test your knowledge with free interactive questions on Seneca — used by over 10 million students.

Lexical Analysis

Lexical analysis is the first stage a compiled language goes through to compile code.

White space

White space

  • Firstly, white space is removed from the code.
  • This is the white space that is present to help humans read the code.
  • The compiler doesn’t need the white space so it is removed.
Tokens

Tokens

  • The compiler will then look through the code and create tokens out of the keywords and operators it finds (lexemes).
  • A token is a string that is recognised by the computer.
    • For example, the number 8 might be assigned the token 'number:8'.
  • Any comments are ignored by the compiler.
Symbol table

Symbol table

  • These tokens are assembled into a symbol table ready for the next step of the compiling process.
Jump to other topics
1

Components of a Computer

2

Software & Software Development

3

Exchanging Data

4

Data Types, Data Structures & Algorithms

5

Legal, Moral, Cultural & Ethical Issues

6

Elements of Computational Thinking

6.1

Thinking Abstractly

6.2

Thinking Ahead

6.3

Thinking Procedurally

6.4

Thinking Logically

6.5

Thinking Concurrently

7

Problem Solving & Programming

8

Algorithms

Practice questions on Lexical Analysis

Can you answer these? Test yourself with free interactive practice on Seneca — used by over 10 million students.

  1. 1
    Lexical AnalysisPut in order
  2. 2
Answer all questions on Lexical Analysis

Unlock your full potential with Seneca Premium

  • Unlimited access to 10,000+ open-ended exam questions

  • Mini-mock exams based on your study history

  • Unlock 800+ premium courses & e-books

Get started with Seneca Premium