Our Services

Get 15% Discount on your First Order

[rank_math_breadcrumb]

430 CMSC

CMSC 430 Project 3

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

complete language.

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 x: integer, y: integer returns character;

One would execute the program as follows:

$ ./compile < test.txt 10 -10

In this case, the parameter x would be initialized to 10 and the parameter y to -10. An example

of a program execution is shown below:

$ ./compile < test.txt 10 -10

1 // Determines the quadrant of a point on the x-y plane

2

3 function main x: integer, y: integer returns character;

4 begin

5 if x > 0 then

6 if y > 0 then

7 ‘1’;

8 elsif y < 0 then

9 ‘4’;

10 else

11 ‘Y’;

12 endif;

13 elsif x < 0 then

14 if y > 0 then

15 ‘3’;

16 elsif y < 0 then

17 ‘2’;

18 else

19 ‘Y’;

20 endif;

21 else

22 if y <> 0 then

23 ‘X’;

24 else

25 ‘O’;

26 endif;

27 endif;

28 end;

Compiled Successfully

Result = 52

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 case statement and decimal integer and real literals only. You are to add the necessary code

to include all of the following:

 Hexadecimal integer and character literals that include escape characters

 All additional arithmetic operators

 All additional relational and logical operators

 Both if and fold statements

 Functions with multiple variables

 Functions with parameters

The fold statement repeatedly applies the specified operation to the list of values, producing one

final value. A left fold associates the operator left to right and a right fold right to left. For

example, the following left fold:

fold left – (3, 2, 1) endfold;

would be evaluated as ((3 – 2) – 1) = 0, but using a right fold:

fold right – (3, 2, 1) endfold;

It would be evaluated as (3 – (2 – 1)) = 2. For operations that are associative, the result would be

the same whether it is as folded to the left or right.

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 project.

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:

a. A discussion of how you approached the project

b. 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

c. A discussion of lessons learned from the project and any improvements that could

be made

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions

Public safety Communications

Subscribe The Communications and Cyber Resiliency Toolkit provides guidance for establishing resiliency measures, public safety communications can better withstand potential disruptions to service. This toolkit, developed by CISA, describes networks and systems critical to successful communication and cyber resiliency and possible threats while providing many resources and additional links for

Case Study 4 o Data (computer)

Follow the attached instructions to complete this work Unit 4 Case Study Directions Review the following case study. Consider both the big-picture ideas and the specific concerns. Make use of the key terms and concepts from the readings in your written responses to the questions below. The case study paper

Discussion 5 and 6

Follow  the attached instructions to complete this work Unit 5 Discussion   Overview In this discussion, you will be considering the emphasis on aspects such as privacy and safety. You will reflect on the significance of the legal concerns and goals of public-private partnerships to address cybersecurity. You will also

SQL injection

Hey! ????  I need an expert in SQL injection, DDOS attack, Code injection attack, XSS attack! To talk further please contact me on discord at mara411 so we can talk more freely and then I will hire you on here! Thanks ???? 

Free CAD, FeniCS or paraview

I have attached the picture and sample work too, I need work as like sampl, but not the copypasted Make sure you can ask me multiple questions but not dont do rubbish work

database

2. Final Assignment – equivalent to 4,000 words The final module mark is based on two deliverables focused on the CarNow case study described below. – 50% of the final mark a. An advisory report – 50 % of the final mark Includes 5% (of the module grade) given for

Computer

Documentation Tabula Insurance Agency ENTER AND UPDATE COMPANY DATA Author: Ashanti Joyner Note: Do not edit this sheet. If your name does not appear in cell B6, please download a new copy of the file from the SAM website. Personnel Tabula Insurance Agency Personnel: April 4-10, 2024 Employee Name Salary

Computer class

All information is below Toronto converted a declining part of the city into a vibrant neighborhood using the smart city 1.0 approach when a local technology company introduced electric shuttle buses to replace private cars and intelligent traffic lights to regulate the flow of pedestrians, bicycles, and vehicles. From Frankl,

Week 15

Read attachments for assignments  Week 14 Feedback Overall Feedback Well done on this assignment You will have to refine your tables and figures for your final submission. Always introduce them to the reader in preceding paragraph, properly create APA table, and cite figures. See Video:   APA Tables and Figures

Prof Double R

  PowerPoint Presentation: Narrative Presentation to the Board of Trustees The Centers for Medicare & Medicaid Services (CMS) has taken on a more visible role in health care. A great deal of change has transpired to improve patient safety and implementation of additional quality metrics. The new health care reform

Week 14

Please read attachments for details  image1.png

Week 13

Read attachments for details  The Finishing Touches – Week 13 Instructions For this week’s assignment you will submit the material discussed in the lesson plan and summarized below: · A refined introduction (Mandatory) · Updated Title Page (Mandatory) · Copyright Page with Declaration (Mandatory) · Dedication Page (Optional) · Acknowledgement

SCMT699

please read attachments for assignment  Feedback from week 10 Please address your design before your next submission.  Its how you are going to go about conducting your research so other can duplicate it. This is a good book on it. Creswell, J. W. (2009). Research design: Qualitative, quantitative, and mixed

Discussion 2

Follow the attached instructions to complete this work. Using ChatGPT or another generative AI tool, you will request SQL code for a business problem using simple user requirement terms. Then you will plug that into MySQL to reverse engineer an ERD. You and your classmates will discuss misalignments between what

Week 10

Read attachment for details  Week 8 Feedback Overall Feedback Theory is one of the most difficult concept to grasp.  Your study must be based on a theory and align with what you are attempting to explore and what you are trying to answer based on previous gaps in research. Well

hw2

This problem exercises the basic concepts of game playing, using tic-tac-toe as an example.  We define Xn as the number of rows, columns, or diagonals with exactly n X’s and no O’s.  Similarly, On is the number of rows, columns, or diagonals with exactly n O’s.  The utility function assigns

Computer Science Homework 2

Homework 2. Question 1. Decision Tree Classifier [10 Points] Data: The zip file “ hw2.q1.data.zip” contains 3 CSV files: · “ hw2.q1.train.csv” contains 10,000 rows and 26 columns. The first column ‘ y’ is the output variable with 2 classes: 0, 1. The remaining 25 columns contain input features: x_1,