I need to execute the code for a parsed input

Closed

Description

For this assignment we are expanding on assignment 3. Now that we have parsed input, we will execute the code.

As a reminder, the language has the following rules:

1. An empty string is a semantic error.

2. The language contains only two types: a string and an integer.

3. The language contains only two statements: a print statement, and a set statement.

4. PRINT means evaluate the expression and printing the result on standard out.

5. SET means evaluate the expression and save the value in the variable named ID

6. It is an error to use a variable that has not been set.

7. The addition and multiplication operators associate left-to-right.

8. Addition is defined only between two integers or two strings. String addition is concatenation.

9. Multiplication is defined between two integers or between an integer and a string. Multiplying a string by an

integer X repeats the string X times.

10. The language includes a subscripting operator which may have one or two expressions inside the square

bracket, separated by a semicolon. Both expressions must evaluate to integers, which are used as indexes into

the string (starting, of course, from zero). A single expression results in a string containing the single character

at that position. Two expressions results in a substring beginning at the first position and ending at the

character before the second position. If either of the expressions would access a character that is not in the

string, this will be deemed a runtime error.

11. All other combination of types and operations are undefined.

For this assignment, after parsing you must perform all semantic checks and execute the program. Please note that

some of the checks can be performed statically (an empty string constant is an error, and using a variable before

setting it is an error), but some can only be performed at run time.

Failing a static check should print an error message and stop execution. Failing a dynamic check should print the

string RUNTIME ERROR followed by a description of the error (for example; RUNTIME ERROR types being added

are not permitted).

Observe that doing this assignment involves evaluating the parse tree, which is a recursive operation. Defining a

virtual eval() function, with different implementations in different classes, is a useful approach. It’s also likely that

you will need to define some idea of a Type and a Value for this assignment. The eval() function will likely want to

return a Value, and will need to test a Type.

Your program should read the file whose name is passed as a command line argument, or the standard input if no

command line argument is provided. You may divide this assignment into as many files as you like. You MUST use

p2lex.h from the last assignment, with no changes. You MUST have your lexical analyzer in a separate file.

Skills: C++ Programming

See more: i need part time worker, i need part time jobs in dubai for graphic designer, i need part time book keeper dublin, i need i vedio teaching on how design wep side, i need i need google translator, can marketers create need, can a marketer create need, does marketer create need, what do i need to create developer android app company, i need to find a professional to create blueprints for a machine in lawrence ma, i need to create a video, i need someone to create a basic site similar, i need part time telemarketer, i need part time fashion designers in thane, i need part time accountant job in sharjah, i need freelancer to create website, i need a graphic designer to create image for shirt for bowling team, i need a freelance developer to create a software, i have a logo sketch but need a logo designer to create it on the computer, hello i need to create a logo and a name to put on my clothing brand, javascript time input code, create need, excel input code, code upload bulk images time php, need part time seo

Project ID: #12228879

Awarded to:

NovaSofts

Hello Sir/Mam NovaSofts Inc. is the leading IT Company of Islamabad Pakistan. We have 9+ years of experience and strong knowledge about programming languages Java C++ C C# Android So you don't worry about thir More

$220 USD in 5 days
(62 Reviews)
5.8

12 freelancers are bidding on average $169 for this job

hbxfnzwpf

I am very proficient in c and c++. I have 16 years c++ developing experience now, and have worked for more than 6 years. My work is online game developing, and mainly focus on server side, using c++ under linux environ More

$120 USD in 3 days
(60 Reviews)
6.3
$248 USD in 3 days
(27 Reviews)
5.0
wangbeizou

Hello. Employer. I have read and understood the project. I'm an Expert in Data Structures and Algorithms. And I know well ; Java ,C/C++, Python ,PHP. I'm interested this project. So, firstly I want to discuss More

$200 USD in 3 days
(32 Reviews)
4.7
pkcoder

Hi, I am a qualified programmer with hands on experience in C/C++ and Java. I have deep knowledge of compilers and i have worked on the similar projects before. I can do this job efficiently in short time. Please get b More

$180 USD in 5 days
(13 Reviews)
3.9
$244 USD in 3 days
(4 Reviews)
3.7
$30 USD in 3 days
(14 Reviews)
3.5
songblue

Dear, I have already read your job post in carefully and understood it well. I have good and full experiences on mathematics and algorithm, computation, numerical analysis, digital image processing using C/C++, Mat More

$222 USD in 3 days
(3 Reviews)
2.6
ymams

How are you, Sir. I'm very exciting for your job. I have an full experience with that and have many sources,too. If I work with you, your task will be better. Thank you.

$250 USD in 3 days
(3 Reviews)
2.7
xiaosoft

★★★★★ Full 5 mark, Certificated Developer from Freelancer. Dear Employer. I’m an expert mobile programming with more than 4 years working. So, I think you’ll find, I’ve the skills you’re looking for. I’m very More

$222 USD in 10 days
(1 Review)
2.9
Siokellc

(((((((((((((((( i can help you very low price Chat me now please now )))))))))))))))))) *************************************************************

$30 USD in 1 day
(0 Reviews)
0.0
Valuesolutions

Hello, how are you? I hope you have a bright day/evening from your side. I have read the details provided, but please contact me so that we can discuss more on the project. I believe I have the required skills in this More

$147 USD in 3 days
(0 Reviews)
0.0
$155 USD in 4 days
(0 Reviews)
0.0
MarshaMalone

Hi Marsha here, I hope you will consider me for your project. I will assure you a quality end product at a competitive price. I know you will be swamped with bids so thank you for the time. Hoping to hear from you soon More

$155 USD in 3 days
(0 Reviews)
0.0
Topfreelancer4

Feel fee to contact me for.Shoot me message to discuss further more details .We provide the comments,images,videos,demos and live sessions in order to help the clients.Make payment only after the work done. You ca More

$100 USD in 3 days
(0 Reviews)
0.0