1. Homepage
  2. Programming
  3. CS320 Programming Languages - Coding #3: Reverse Polish calculator

CS320 Programming Languages - Coding #3: Reverse Polish calculator

Engage in a Conversation
Bellevue CollegeCS320Programming LanguagesJavaC++ANTLR

CS 320-11509 Coding #3 CourseNana.COM

Using ANTLR to implement a reverse Polish calculator

20 points for the coding project CourseNana.COM

We will leverage ANTLR to implement a reverse polish calculator. Write code in Java or C++ if you prefer. CourseNana.COM

1.     Write the grammar for the following mathematical operations in ANTLR: CourseNana.COM

       Arithmetic operations: ** (power) CourseNana.COM

       Logarithmic functions: log (base 10), ln (base e) CourseNana.COM

       Trigonometric functions: sin, cos, tan, asin, acos, and atan CourseNana.COM

       Hyperbolic trigonometric functions: sinh, cosh, tanh CourseNana.COM

       Factorial function: CourseNana.COM

       Special number: e (Euler number), pi (π) CourseNana.COM

       () to override operator precedence. CourseNana.COM

       Numbers: integer, float, and scientific CourseNana.COM

2.     Generate lexer and parser code from ANTLR grammar. CourseNana.COM

3.     Implement code to generate reverse Polish expression from input and the computation result, up to the 5th decimal place. CourseNana.COM

       Do NOT print trailing 0’s after the decimal point. CourseNana.COM

       If there is no trailing 0’s after the decimal point, do not print the decimal point. Only print the integer part. CourseNana.COM

4.     Write unit tests. CourseNana.COM

Here are some input and output examples: CourseNana.COM

  CourseNana.COM

Code input and output: CourseNana.COM

·       Your code should read from standard input, not from file. CourseNana.COM

·       Input will include one infix expression on each line. CourseNana.COM

·       Your output should include 3 lines per each input: CourseNana.COM

o   1st line: the infix expression CourseNana.COM

o   2nd line: the reverse polish expression, one space character between operators and operands CourseNana.COM

o   3rd line: the value of the expression per specification above CourseNana.COM

Code submission: CourseNana.COM

·       Ideally, you should create a github repository for this assignment and add me as a collaborator so I can comment on your code easily. My github username is ProfWentao. On canvas, you can just include your github repo name. make smaller commits to show your progress. CourseNana.COM

·       If you don’t know how to use github, you can zip up your project and submit to canvas. Make sure that the zip file starts with your name. CourseNana.COM

Reference: reverse Polish notation CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Bellevue College代写,CS320代写,Programming Languages代写,Java代写,C++代写,ANTLR代写,Bellevue College代编,CS320代编,Programming Languages代编,Java代编,C++代编,ANTLR代编,Bellevue College代考,CS320代考,Programming Languages代考,Java代考,C++代考,ANTLR代考,Bellevue Collegehelp,CS320help,Programming Languageshelp,Javahelp,C++help,ANTLRhelp,Bellevue College作业代写,CS320作业代写,Programming Languages作业代写,Java作业代写,C++作业代写,ANTLR作业代写,Bellevue College编程代写,CS320编程代写,Programming Languages编程代写,Java编程代写,C++编程代写,ANTLR编程代写,Bellevue Collegeprogramming help,CS320programming help,Programming Languagesprogramming help,Javaprogramming help,C++programming help,ANTLRprogramming help,Bellevue Collegeassignment help,CS320assignment help,Programming Languagesassignment help,Javaassignment help,C++assignment help,ANTLRassignment help,Bellevue Collegesolution,CS320solution,Programming Languagessolution,Javasolution,C++solution,ANTLRsolution,