Program - Implements a calculator of C integer expressions

Assignment Help Programming Languages
Reference no: EM131710931

Project - Topic: Cexpr Programming Assignment

Your assignment is to write a program using yacc (bison) and lex (flex) that implements a calculator of C integer expressions. The calculator will process expressions until it encounters EOF or invalid syntax. Each calculation is terminated by a semicolon. Tokens can be separated by whitespace (but no comments). After each calculation, the calculator prints its result. Tokens include integer numbers and 26 predefined integer variables. There will be one variable corresponding to each of the lowercase letters in the alphabet. The table below defines the C operators you need to implement. The operators are listed in order of decreasing precedence.

Yacc (bison) does provide mechanisms for specifying the associativity and precedence of operators in an unambiguous grammar. However, you are not allowed to use these mechanisms. Instead you should define extra non-terminals and productions to enforce the specified associativity and precedence for this assignment.

Rather than having a default value of zero for each of the predefined variables, you will treat the default variable as having an unknown value. If a variable's value is referenced without ever having been assigned a value, then the value of the expression should be designated as unknown. A variable's value becomes unknown when it is assigned an unknown value.

In addition to calculating an expression, two other commands are supported. The first is to dump the values of the different variables when the keyword dump is detected. The second is to reset all of the values of the different variables to unknown when the keyword reset is encountered.

You need to create files called cexpr.y, scan.l and makefile that will contain the parser, scanner and makefile. The makefile should make an executable called cexpr.exe. You should submit a single zip (tar) file that includes these three files, to Canvas project link.

The reference executable (cexpr.exe) is placed in ~uh/cop4020/proj4/cexpr.exe for your info.

Attachment:- Assignment File.rar

Reference no: EM131710931

Questions Cloud

Explain in perfect competitive environment : Define short run. Explain in perfect competitive environment Try to use mathematical expressions Fixed cost for perfect competitive firms is straight
Dominant players in respective industries : Both Walmart and Apple are dominant players in their respective industries. What are the implications of this for their supply chains?
Describe the difference between power and influence : Describe the difference between power and influence. Describe the different types of power.
Write an essay about something you believe after reading : Write your own 2-3 page essay, about something you believe after reading 3 of the essays.
Program - Implements a calculator of C integer expressions : COP4020 Project - Topic: Cexpr Programming Assignment. Your assignment is to write a program using yacc (bison) and lex (flex) that implements a calculator
Context and competencies of the team effectively : How do high-performing teams manage context and competencies of the team effectively? Break down and explain each.
Discuss how could a speaker prepare for questions : instructor told them they had to ask a question to get a full grade for the assignment. How could a speaker prepare for questions
Discuss about the international bill of human rights : And do we need to adopt an "International Bill of Human Rights," as Coleman also suggests, in response to global challenges posed by workplace monitoring?
Name four interoperability issues : Name four interoperability issues where the patient's orders and their processing in the hospital was not managed well by healthcare

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

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