Earn Higher Grades With Instant Assignment Help.Ask Question!

Computer Science
(5/5)

When the program is run on the command line, the parameters to the function should be supplied as command line arguments.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Project 3

Linux environment > Ubuntu and the flex, bison, and GNU g++

The third project involves modifying the attached interpreter so that it interprets programs for the complete language.

You may convert all values to double values, although you can maintain their individual types if you wish.

When the program is run on the command line, the parameters to the function should be supplied as command line arguments. For example, for the following function header of a program in the file text.txt:

function main a: integer, b: integer returns integer;

One would execute the program as follows:

$ ./compile < test.txt 2 4

In this case, the parameter a would be initialized to 2 and the parameter b to 4. An example of a program execution is shown below:

$ ./compile < test.txt 2 4

  • function main a: integer, b: integer returns integer;
  • c: integer is
  • if a > b then
  • a rem b;
  • else

6              a ** 2;

  • endif;
  • begin
  • case a is
  • when 1 => c;

11          when 2 => (a + b / 2 - 4) * 3;

  • others => 4;
  • endcase;
  • end;

 

Compiled Successfully Result = 0

After the compilation listing is output, the value of the expression which comprises the body of the function should be displayed as shown above.

The existing code evaluates some of the arithmetic, relational and logical operators together with the reduction statement and integer literals only. You are to add the necessary code to include all of the following:

  • Real and Boolean literals
  • All additional arithmetic operators
  • All additional relational and logical operators
  • Both if and case statements
  • Functions with multiple variables
  • Functions with parameters

This project requires modification to the bison input file, so that it defines the additional the necessary computations for the above added features. You will need to add functions to the library of evaluation functions already provided in values.cc. You must also make some modifications to the functions already provided.

You are to submit two files.

  1. The first is a .zip file that contains all the source code for the project. The .zip file should contain the flex input file, which should be a .l file, the bison file, which should be a .y file, all .cc and .h files and a makefile that builds the
  2. The second is a Word document (PDF or RTF is also acceptable) that contains the documentation for the project, which should include the following:
    1. A discussion of how you approached the project
    2. A test plan that includes test cases that you have created indicating what aspects of the program each one is testing and a screen shot of your compiler run on that test case
    3. A discussion of lessons learned from the project and any improvements that could be made
Attachments:
(5/5)

Related Questions

CSI 1420 Introduction to C Programming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu

The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Assignment To Be Done By Our ExpertsGet A+ Grade Solution Guaranteed

expert
joyComputer science
(4/5)
12 Answers Hire Me
expert
Robert DLaw
(4.8/5)
626 Answers Hire Me
expert
Dr Samuel BarberaStatistics
(5/5)
704 Answers Hire Me
expert
Tutor For YouEconomics
(5/5)
586 Answers Hire Me