Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
20 points for the coding project
We will leverage ANTLR to implement a reverse polish calculator. Write code in Java or C++ if you prefer.
1. Write the grammar for the following mathematical operations in ANTLR:
① Arithmetic operations: (power)
② Logarithmic functions: log (base 10), ln (base e)
③ Trigonometric functions: sin, cos, tan, asin, acos, and atan
④ Hyperbolic trigonometric functions: sinh, cosh, tanh
⑤ Factorial function:
⑥ Special number: e (Euler number), pi (π)
⑦ () to override operator precedence.
⑧ Numbers: integer, float, and scientific
2. Generate lexer and parser code from ANTLR grammar.
3. Implement code to generate reverse Polish expression from input and the computation result, up to the 5th decimal place.
① Do NOT print trailing 0’s after the decimal point.
② If there is no trailing 0’s after the decimal point, do not print the decimal point. Only print the integer part.
4. Write unit tests.
Code input and output:
· Your code should read from standard input, not from file.
· Input will include one infix expression on each line.
· Your output should include 3 lines per each input:
o 1st line: the infix expression
o 2nd line: the reverse polish expression, one space character between operators and operands
o 3rd line: the value of the expression per specification above
Code submission:
· 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.
· 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.