Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[Compiler] [Python] Implement Lexical analyzer using PLY (Python Lex-Yacc: github.com/dabeaz/ply) - Read input from the input file. - Support real numbers in both the decimal

[Compiler] [Python] Implement Lexical analyzer using PLY (Python Lex-Yacc: github.com/dabeaz/ply)

- Read input from the input file.

- Support real numbers in both the decimal and scientific notation.

- A variable should start with any character and may follow by any alphanumeric character or underscore.

- Supported operators are

image text in transcribed

- Any number of whitespace characters between tokens and operators is valid e.g. 2 +3== 5

- Only one assignment per one input line.

- Output file in plain text with tok extension. (e.g. output.tok)

- Testcase: drive.google.com/file/d/1J1GjIbFrQ7REHHPTjTNKXJmHy7RJq2dq/view?usp=sharing

Each line in the output file should be in the following format:

image text in transcribed

For example,

image text in transcribed

Addition (+) Subtraction (-) Multiplication () Floating point division (/) Greater than or equal to = Less than () Less than or equal to (-) Equal to () Not cqual to (! Parentheses (...) Assignment () - Integer division (//) Exponent Greater than (>)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions