Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 1.26 KB

readme.md

File metadata and controls

23 lines (17 loc) · 1.26 KB

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

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