Question: Problem Statement Python Program You are to develop a simple lexical analyzer in python. Your analyzer should store a stream of lexemes in a list.

 Problem Statement Python Program You are to develop a simple lexical

Problem Statement Python Program You are to develop a simple lexical analyzer in python. Your analyzer should store a stream of lexemes in a list. A lexeme consists of a token category and the actual text. Your program will: .Open a single text input file . Scan the file, line by line, to produce the token stream o For each line, display to the screen, the token-typelist -Ex: Line 3: A1A2 345; - Would produce a line of output like: 3: IDENT, ASSIGNOP,IDENT, MULTOP, INT, TERM o If there is an error on a line, note the line number ( & error message to the screen) and skip on to the next line .Produce a symbol table that stores each Identifier and a list of the lines on which that particular Identifier appears gnore white space between tokens. Although, whitespace is not required. A1 A1 345; is the same as - A1-A1 345; Write an output file that contains a copy of the symbol table (Sort the identifiers in alphabetic/alphanumeric order) Your lexical analyzer must recognize the following categories of token: o (IDENT) Identifiers: start with a letter, followed by any combination of letters and digits o (INT) Integers: any sequence of digits o (MULTOP) Multiplication operator ,/ o (ADDOP) Addition operators (ASSIGNOP) Assignment operators?+-,--, *-, /- (TERM) Terminator symbol; o Other symbols not listed would be errors because they would be unrecognized

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!