Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code must be executed in PYTHON3. Code must be executed on the command line by typing python3 parser.py sample.tiny. Will rate if correct. Thank you.

image text in transcribedCode must be executed in PYTHON3. Code must be executed on the command line by typing "python3 parser.py sample.tiny". Will rate if correct. Thank you.

Hi, to whoever commented that more information is needed, this is all the information that's given and all that's required..

In this project you are asked to write an interpreter which uses the top-down recursive-descent method to parse and evaluate a very simple programming language. The tiny language's grammar is given below. ::= empty | ::=id = ; print ; ::= { + - } .:= { * /} := id | intnum|() The interpreter (parser.py) should be written in Python. It takes one input file (sample.tiny) which contains the program to be executed. The input file name sample.tiny is given from the command line. The interpreter parser.py reads the program file sample.tiny, checks the syntax and outputs the result if the program is legitimate; otherwise, the interpreter prints "Syntax Errors". Below are some test examples in sample.tiny: print 2 + 3 * 4; s = 2 + 3; t = 9 2 ; prints print ( s + t ) * ( s - t) ; * t ; In this project you are asked to write an interpreter which uses the top-down recursive-descent method to parse and evaluate a very simple programming language. The tiny language's grammar is given below. ::= empty | ::=id = ; print ; ::= { + - } .:= { * /} := id | intnum|() The interpreter (parser.py) should be written in Python. It takes one input file (sample.tiny) which contains the program to be executed. The input file name sample.tiny is given from the command line. The interpreter parser.py reads the program file sample.tiny, checks the syntax and outputs the result if the program is legitimate; otherwise, the interpreter prints "Syntax Errors". Below are some test examples in sample.tiny: print 2 + 3 * 4; s = 2 + 3; t = 9 2 ; prints print ( s + t ) * ( s - t) ; * t

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

Question

How can you observe parity violation in the decay v?

Answered: 1 week ago

Question

What are the advantages and disadvantages of e-learning?

Answered: 1 week ago

Question

Describe Table Structures in RDMSs.

Answered: 1 week ago