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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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