Coding Programming

Completed Posted Oct 4, 2015 Paid on delivery
Completed Paid on delivery

The project involves completing and extending the C++ program that evaluates statements of an expression language contained in the module 3 case study.

The statements of that expression language consist of an arithmetic expression followed by a list of assignments. Assignments are separated from the expression and each other by commas. A semicolon terminates the expression. The arithmetic expressions are fully parenthesized infix expressions containing integer literals and variables. The valid arithmetic operators are +, –, *, /. Tokens can be separated by any number of spaces. Variable names begin with an alphabetic character, followed by any number of alphanumeric characters. Variable names are case sensitive. This syntax is described by BNF and regular expressions in the case study.

The program reads in the arithmetic expression and encodes the expression as a binary tree. After the expression has been read in, the variable assignments are read in and the variables and their values of the variables are placed into the symbol table. Finally the expression is evaluated recursively.

Your first task is to complete the program provided by providing the three missing classes, Minus, Times and Divide.

Next, you should extend the program so that it supports relational, logical and conditional expression operators as defined by the following extension to the grammar:

<exp> -> '(' <operand> <op> <operand> ')' |

'(' <operand> ':' <operand> '?' <operand> ')' |

'(' <operand> '!' ')'

<op> -> '+' | '-' | '*' | '/' | '>' | '<' | '=' | '&' | '|'

Note that there are a few differences in the use of these operators compared to their customary use in the C family of languages. There differences are

In the conditional expression operator the symbols are reversed and the third operand represents the condition. The first operand is the value when true and the second the value when false

The logical operators use single symbols not double, for example the and operator is & not &&

The negation operator ! is a postfix operator, not a prefix one

There are only three relational operators not the usual six and the operator for equality is = not ==

Like C and C++, any arithmetic expression can be interpreted as a logical value, taking 0 as false and anything else as true

Your final task is to make the following two modifications to the program:

The program should accept input from a file, allowing for multiple expressions arranged one per line. Some hints for accomplishing this transformation will be provided in the conference

All results should be changed from double to int. In particular the evaluate function should return an int.

You may assume that all input to the program is syntactically correct.

You are to submit the source code for the entire program in a .zip file. Your program must compile with Microsoft Visual C++.

C++ Programming Java

Project ID: #8612885

About the project

14 proposals Remote project Active Oct 5, 2015

Awarded to:

mahershahmeer

Hi there! I'm a Professional Software developer and Data Analyst for a well known Software House in Islamabad named PacSquare Pvt Ltd. If I get this job, I assure you that you'll get my best services in return. Plea More

$40 USD in 3 days
(130 Reviews)
6.2

14 freelancers are bidding on average $123 for this job

Yknox

Hello I'm interesting your project very well I'm a Good C++, Java, Compiler-Copiler, Math, Algorithm expert. I understand your req exactly. I m quite well experienced in these jobs. Let's go ahead with me I w More

$210 USD in 2 days
(859 Reviews)
9.1
dobreiiita

Hello I am C++ and Algorithm expert and interested in this project. I have gone through the details and confident to handle this project. I also have a lot of experience in helping students with assignments. Ple More

$150 USD in 3 days
(519 Reviews)
7.6
mitkoradev

Hi, this seems like a nice project. I think it won't take more than few hours at most, maybe even less if I haven't misunderstood some details. I propose to do the job and send an executable for tests, after some ne More

$55 USD in 3 days
(158 Reviews)
6.7
ahmsak

Hello Sir... I am a computer science teacher, I teach (among others) Compilers and Algorithms. I have done many projects like this. Please contact me for more details when possible. I look forward to work for you S More

$160 USD in 3 days
(71 Reviews)
6.0
rinabuoy13

A proposal has not yet been provided

$55 USD in 3 days
(39 Reviews)
5.7
mehmood168

Hello, I am a Java developer with strong expertise and vast experience. I have understood the requirements. I am ready to work for you. Will give you the best results, on-time delivery. Thanks

$56 USD in 2 days
(49 Reviews)
5.4
Egran

i usually work under TDD, so i would send you unit tests

$200 USD in 5 days
(6 Reviews)
3.7
KarimRagab

I am an embedded software engineer with years of experience in Java and C/C++ programming, doing my master's degree with 'A' total subject's grade in artificial intelligence and machine learning. I will do my best t More

$55 USD in 3 days
(14 Reviews)
3.5
saunv2012

A proposal has not yet been provided

$166 USD in 3 days
(0 Reviews)
0.0
upalavivek

A proposal has not yet been provided

$77 USD in 15 days
(0 Reviews)
0.0
aravakrishna

A proposal has not yet been provided

$200 USD in 7 days
(0 Reviews)
0.0