You are on page 1of 2

LAB # 03

Create a file (Comiler.cc) & Implement a Program to read all the content
of a Compiler.cc (how many lines, how many words and how many
character in the file) .

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:

Type any strings with combinations of letters / characters of sentence..Construct automata.

Output:

Sequences of transition states with accepting states.

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.

You might also like