Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem Description: Our Emcee language included expressions, as defined in the BNF below: expression :Constant identifier expression binary op expression unary_op expre33ion identifier LEFT PAREN

image text in transcribedimage text in transcribedimage text in transcribed

Problem Description: Our Emcee language included expressions, as defined in the BNF below: expression :Constant identifier expression binary op expression unary_op expre33ion identifier LEFT PAREN expression list RIGHT PAREN identifier LEFT PAREN RIGHT PAREN LEFT_FAREN expression RIGHTPAREN constant REAL_CONST I INT_CONST STRING_CONST binary op ::= PLUS MINUS MUL DIVIDE I CARAT IMOD unary_op ::- MINUS As we prepare to complete our Emcee interpreter, you are to create C+ classes that implement the portions highlighted above. For binary operators, you need only handle +, -,and/. Your unary operator should handle -. Constants are always integers. The design for these classes can be found below Declare all your C+classes in the file "expression.h". A reminder about expression notation: An infix expression places the operator between two operands, or in front of a single operand (e.g. 1 2, or -3). A postfix expression alway:s puts the operator after the operands (e.g. 12+, or 3 u. To avoid confusion, when printing a unary - in postfix format, use the notation u- (as shown above and also in the example below). When printing infix, use parentheses liberally (again, see example below) To test your classes, run the main program defined below. This program creates thee following expression, evaluates it, and then prints it in infix and postfix formats -3(4(9/ 3)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

What information remains to be obtained?

Answered: 1 week ago