Compiler Lab Assignment 2-Lexical Analysis Solved

30.00 $

Category:

Description

5/5 - (1 vote)

Lab Assignment 2- Lexical Analysis

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

 

  • Expected output:

 

  • lab2_Lexical_analysis-6hmk0x.zip