[SOLVED] Compiler- Lab 2: Lexical Analysis

25.00 $

Programming resource
Digital learning resource
Category:
✓ Practical programming resource
✓ Suitable for guided study and reference
✓ Tutor guidance available when needed

Description

Rate this product

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

 

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.