Skip to content

A CPP lexical analyzer to read sequence of characters and produce tokens.

Notifications You must be signed in to change notification settings

ziaKhan1995/cpp-lexical-analyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Compiler construction

Note: The symbol table has been created using Dynamic Linked List in order to ensure no limit for number of variables declared.

Lexical Analyzer Using C++

This Lexical Analyzer

convert the input from a simple sequence of characters into a list of tokens of different kinds such as numerical and string constants, variable identifiers, and programming language keywords. The lexical analyzer identifies the error with the help of the automation machine and the grammar of the given language on which it is based like C, C++, and gives row numbers and column numbers of the error. Following is the algorithm for the code: ALGORITHM: 1.Tokenization i.e. Dividing the program into valid tokens. 2. Remove white space characters. 3. Remove comments. 4. It also provides help in generating error messages by providing row numbers and column numbers. The code can be hence used, directly by running it on the machine.

input.txt file

image

Output

image

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Releases

No releases published

Packages

No packages published

Languages