2.2.14

Lexical Analysis

Test yourself

Lexical Analysis

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

Illustrative background for White spaceIllustrative background for White space ?? "content

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.
Illustrative background for TokensIllustrative background for Tokens ?? "content

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.
Illustrative background for Symbol tableIllustrative background for Symbol table ?? "content

Symbol table

  • These tokens are assembled into a symbol table ready for the next step of the compiling process.

Jump to other topics

1Components of a Computer

2Software & Software Development

3Exchanging Data

4Data Types, Data Structures & Algorithms

5Legal, Moral, Cultural & Ethical Issues

6Elements of Computational Thinking

6.1Thinking Abstractly

6.2Thinking Ahead

6.3Thinking Procedurally

6.4Thinking Logically

6.5Thinking Concurrently

7Problem Solving & Programming

8Algorithms

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