Starting from:

$25

Compiler- Lab 2: Lexical Analysis Solved

In this assignment, you will work on implementing a lexical analyzer in your preferred programming language. We will consider some basic constructs (e.g., if-else statements), understand what are the different tokens (and patterns for the tokens) in the considered language/constructs.

Implement a lexical analyzer (using any programming language) for the considered tokens/patterns.  Your program should take a statement as input and return the sequence of tokens as output.

-------------------------------------------------------------------------------------------------------------------------------------

Let us consider the example grammar for branching statements given below: 

 

The patterns for the tokens in the language are described below:   

Implement a lexical analyzer using any programming language. Your program should take a statement as input and return the sequence of tokens as output.

-----------------------------------------------------------------------------------------------------------------------------------

Example Input: if input<10 then output1=100 else output2>=100
 

More products