CMSC 430 Introduction to Compilers Assignment

Assignment Help Computer Engineering
Reference no: EM132690724

CMSC 430 Introduction to Compilers - University of Maryland

Project
The second project involves modifying the syntactic analyzer for the attached compiler by adding to the existing grammar. The full grammar of the language is shown below. The highlighted portions of the grammar show what you must either modify or add to the existing grammar.

function:
function_header {variable} body

function_header:
FUNCTION IDENTIFIER [parameters] RETURNS type ;

variable:
IDENTIFIER : type IS statement

parameters:
parameter {, parameter}

parameter:
IDENTIFIER : type

type:
INTEGER | REAL | BOOLEAN

body:
BEGIN statement END ;

statement: expression ; |
REDUCE operator {statement} ENDREDUCE ; |
IF expression THEN statement ELSE statement ENDIF ; |
CASE expression IS {case} OTHERS ARROW statement ; ENDCASE ;

operator:
ADDOP | MULOP

case:
WHEN INT_LITERAL ARROW statement

expression:
( expression ) |
expression binary_operator expression |
|

INT_LITERAL | IDENTIFIER

| BOOL_LITERAL |

binary_operator: ADDOP | MULOP | REMOP | EXPOP | RELOP | ANDOP | OROP

In the above grammar, the red symbols are nonterminals, the blue symbols are terminals and the black punctuation are EBNF metasymbols. The braces denote repetition 0 or more times and the brackets denote optional.

You must rewrite the grammar to eliminate the EBNF brace and bracket metasymbols and to incorporate the significance of parentheses, operator precedence and associativity for all operators. Among arithmetic operators the exponentiation operator has highest precedence following by the multiplying operators and then the adding operators. All relational operators have the same precedence. Among the binary logical operators, and has higher precedence than or. Of the categories of operators, the unary logical operator has highest precedence, the arithmetic operators have next highest precedence, followed by the relational operators and finally the binary logical operators. All operators except the exponentiation operator are left associative. The directives to specify precedence and associativity, such as %prec and %left, may not be used

Your parser should be able to correctly parse any syntactically correct program without any problem.

You must modify the syntactic analyzer to detect and recover from additional syntax errors using the semicolon as the synchronization token. To accomplish detecting additional errors an error production must be added to the function header and another to the variable declaration.

Your bison input file should not produce any shift/reduce or reduce/reduce errors. Eliminating them can be difficult so the best strategy is not introduce any. That is best achieved by making small incremental additions to the grammar and ensuring that no addition introduces any such errors.

Attachment:- Introduction to Compilers.rar

Reference no: EM132690724

Questions Cloud

Create a list of measurable outcomes for capstone project : After working with your preceptor to assess organizational policies, create a list of measurable outcomes for your capstone project intervention.
Determine the activity-based cost for servicing patients : Problem - Activity-based costing, service - Determine the activity-based cost for servicing the three representative patients
What health promotion topics do you include in your practice : Anticipate the health-promoting behaviors important at various stages of development across the life span. What health promotion topics do you include in your.
Describe role of technology in improving health care outcome : In each week's entry, students should reflect on the personal knowledge and skills gained throughout the course. Journal entries should address one or more.
CMSC 430 Introduction to Compilers Assignment : CMSC 430 Introduction to Compilers Assignment Help and Solution, University of Maryland - Assessment Writing Service - project involves modifying the syntactic
Problem - Activity Rates and Activity-based Costing : Problem - Activity Rates and Activity-based Costing - The total factory overhead for Engelhardt Company is budgeted for the year at $400,000
Discuss about vaccines including the flu vaccine : The objective of assignment is to provide a power point presentation about vaccines including the Flu vaccine and other vaccines in the pediatric population.
Disadvantages of different structural approaches : Discuss the advantages and disadvantages of different structural approaches.
Example of utilitarian ethics : Is there an example of utilitarian ethics that can be immoral in business?

Reviews

len2690724

11/9/2020 12:55:34 AM

Hi, I want to get the above assignment on compiler design done Its a coding assignment

Write a Review

Computer Engineering Questions & Answers

  Evaluate air properties at an average temperature

A simple solar collector is built by placing a 5-cmdiameter clear plastic tube around a garden hose whose outer diameter is 1.6 cm.

  Explain what are difference in the if-else and if statements

Explain what are differences in if-else and if statements? Why does it make a difference in programming to understand the order of And, or and not statements.

  Definition of artificial intelligence

Most of the posts I have looked at from other classmates start with some definition of Artificial Intelligence

  Prove the convolution theorem for the fourier transform

Prove Parseval's theorem for the Fourier transform.- Prove the modulation property of the Fourier transform.- Prove the convolution theorem for the Fourier transform.

  What is new deployment technology for the .net 2005

what is new deployment technology for the .NET 2005

  When would you create a detailed manual with graphics

How do you determine which training vehicles to use with which audiences? When would you use a video or a series of videos to describe a product?

  Find out how many of each kind of bill to dispense

Write down a program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of ten dollars) and the machine dispenses this amount using the least number of bills. The bills dispensed are 50s, 20s..

  Develop a case study related to hacking

Develop a case study related to hacking. Have an original post of no less than three to five paragraphs, and yes it can be more if you wish.

  Express how the program is to work

Write a GUI program which incorporates a try-catch block to error check the input for integers and alphabetic characters other than Y or N. Your program must include.

  When an entity has the relationship to itself

The presence of one or more foreign keys in a relation prevents. When an entity has a relationship to itself, we have a?

  Write about development of an effective approach

Write about development of an effective approach to integration of cryptography for your project organization.

  What contributes to the complexity of a cloud strategy

What contributes to the complexity of a cloud strategy? How does tactical adoption of cloud services differ from a coordinated cloud strategy?

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