Modify the program to detect and report

Assignment Help C/C++ Programming
Reference no: EM13330842

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 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,TimesandDivide.

Next, you should modify the program to detect and report the following error conditions:

Division by zero should be reported as a division error and the program should proceed to the next expression.

Input containing uninitialized variables should be reported as an initialization error and the program should proceed to the next expression.

Variables initialized but never used should be reported as a warning.

Syntax errors including mismatched parentheses, invalid operator, missing comma, semicolon or assignment operator should be reported as a syntax error and the program should proceed to the next expression.

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.

The Symbol Table class should be modified so that if a variable is assigned multiple values, the last assignment applies.

Reference no: EM13330842

Questions Cloud

In the manufactoring of computer chips cylinders of silicon : In the manufactoring of computer chips, cylinders of silicon are cut into thin wafers that are 3.00 inches in diameter and have a mass of 1.50g of silicon. How thick, in milimeters( mm) is each wafer if silicon has a density of 2.33 g/cm3. The..
Calculate the final velocity of the cars : Two cars collide at an icy intersection and stick together afterward. The first car has a mass of 1600 kg and was approaching at 7.00 m/s due south. Calculate the final velocity of the cars
3 physical chemistry questions : 3 Physical Chemistry Questions
How much farther from this point will the object move : You are watching an object that is moving in SHM. How much farther from this point will the object move before it stops momentarily and then starts to move back to the left
Modify the program to detect and report : Syntax errors including mismatched parentheses, invalid operator, missing comma, semicolon or assignment operator should be reported as a syntax error and the program should proceed to the next expression.
Calculate the concentration of dissolved oxygen at 20 degree : Calculate the concentration of dissolved oxygen at 20 degree Celsius if the amount of dissolved O2 is 9.07 mg/L
Find the stored charge in the capacitor in coulombs : A capacitor of 652. microfarad is charged to 21. volts. Find the stored charge in the capacitor in coulombs
What additional resistance should be added in series : A power supply has an open-circuit voltage of 43.0 V and an internal resistance of 2.00 ?. What additional resistance should be added in series
Why is the temperature 60 instead of 328k : Why is the temperature 60 instead of 328K?

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd