Create a new class called interpreter

Assignment Help Basic Computer Science
Reference no: EM133247714

Assignment:

Finally, we will build (the beginning of) our interpreter. Create a new class called Interpreter. Add a method called Resolve". It will take a Node as a parameter and return a float. For now, we will do all math as ?oating point. The parser handles this order of operations, so this function is very simple. It should check to see what type the Mode is:

  • For 5% return the value.
  • For We, return the value, cast as float.
  • For m it should call Resolve() on the left and right sides. That will give you two floats. Then look at the operation (plus, minus, times, divide) and perform the math.

Make sure that you test your code. Change your main to instantiate a parser (passing in the tokens from the lexer) and then call parse on the parser. Right now, it will only process a single line. Print your AST by using the ToString that you created. Use several different mathematical expressions and be sure that order of operations is respected. Then add a call to Resolve" and checkthe math.

Reference no: EM133247714

Questions Cloud

Review stage in the development life cycle : The life cycle do you think these problem could have originated and been identified by a thorough review following that stage in the development life cycle?
What is the issue : BUSN 102 Chesnut Hill College Three-to-five-page research paper, with citations regarding an ethical issue of Coco-cola company. 1) What is the issue?
Describe the organizational structure of casa de paz company : Assignment - Management Essay - Describe the organizational structure of Casa de Paz company for which you are planning the project
What is a competitive advantage, and how is it related to ba : Why does each step in the business analytics process have a past, present, and future dimension and What is a competitive advantage, and how is it related to BA
Create a new class called interpreter : Finally, we will build (the beginning of) our interpreter. Create a new class called Interpreter. Add a method called Resolve".
Are these strategies effective at addressing all varieties : Traditional Policing Methods Paper - Are these strategies effective at addressing all varieties of crime and criminals? Why/Why not
How important is being considerate and nice in the workplace : ENGL 223 University of Maryland How important is being considerate and nice in the workplace? Who gets ahead: the team member who is always jockeying
What are some of the issues concerning procrastination : BMGT 2303 Houston Community College What are some of the issues concerning procrastination and perfectionism when managing one's self?
Discuss the role of the ministry of health : Discuss the role of the Ministry of Health and Saudi Food and Drug Authority in promoting healthy food and eating habits in the last few years

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Reasons and rationalizations for not voicing or acting

Think of the reasons and rationalizations for not voicing or acting. 1. Which have you observed used most often in your work or school experience? Why do you think they flourish?

  Wap to sum the values in a numeric array

(Totaling an Array's Contents) Write a program that defines and uses macro SUMARRAY to sum the values in a numeric array.

  Estimate the total number of cases sold

The new candy Green Globules is being test-marketed in an area of upstate New York The market research firm decides to sample 6 of the 45 cities in the area.

  Data administration and architecture

Describe three common problems of ineffective data administration. Discuss two-tier and three-tier architecture.

  What is the differences between sampling and polling

What is the difference between raw data, measured data, and agreed data? What is the difference between syntactic agreement and semantic agreement? What is the differences between sampling and polling?

  American concrete canoe competition

Each year, approximately 160 colleges compete in the American Concrete Canoe Competition.

  Calculate and display the rankine

Create a Matlab program that will calculate and display the Rankine, Celsius, and Kelvin equivalent temperature for a user entered Fahrenheit temperature.

  Backdoors in encryption software

You are to research an article either for or against backdoors in encryption software and summarize the article.

  Write a function named structsort that sorts structure array

Test your function by using the buildCDs script from Chapter 7, using the input function to specify the sorting field.

  What is probability of randomly chosen person having cancer

Based on these? results, what is the probability of a randomly chosen person having cancer given that the test indicates? cancer?

  Need vision and mission for it consulting startup

Need vision and mission for a IT consulting startup company.

  What is public-key certificate

What is a public-key certificate? What is the difference between a session key and a master key? What is a chain of certificates?

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