Professional Documents
Culture Documents
Lexical Analysis
Stream of characters is grouped into tokens
Examples of tokens are identifiers, reserved words, integers, doubles or floats,
delimiters,
operators and special symbols int a; a = a + 2; int reserved word a
identifier ; special symbol a identifier = operator a
identifier + operator 2 integer constant ; special symbol
Examples of Token
Token: A sequence of characters to be treated as a
single unit.
• Examples of tokens.
– Reserved words (e.g. begin, end, struct, if etc.)
– Keywords (integer, true etc.)
– Operators (+, &&, ++ etc)
– Identifiers (variable names, procedure names, parameter names)
– Literal constants (numeric, string, character constants etc.)
– Punctuation marks (:, , etc.)
Input:
Output:
Lab Manual
Disclaimer:
This Lab content is purely for educational purposes only and to guide FJWU Software
Engineering students practically. I used various resource materials from different online national
and international documents using PEC & HEC guidelines for the preparation of this lab.