Simulator for handling computations in reverse polish notation

 

Write a program that acts as a simulator for handling computations in reverse polish
notation
1
(RPN)(postfix notation). The program’s user interface should be minimal (e. g., similar to bc(1)
2
).
The program should make use of standard tools for creating/handling syntax analysis and parsing such
as lex(1)
3and yacc(1)
4
.
The following functionality in RPN will be required:
• Simple arithmetic operations (e. g., +, -, *, /)
• Simple trigonometric functions (e. g., sin, cos, tan)
• Grouping of expressions using parentheses
• Application of the above on a list of operands (e. g., “(3.141 (2 3 +) (1.571 sin) *)”, which, for reference, is
≈15.708)
Please, provide test cases to verify your implementation.
1https://en.wikipedia.org/wiki/Reverse_Polish_notation
2https://en.wikipedia.org/wiki/Bc_(programming_language)
3https://en.wikipedia.org/wiki/Lex_(software)
4https://en.wikipedia.org/wiki/Yacc
Write a short report. Structure this report by providing insight into why and how you selected a certain
technology or programming paradigm to solve the problem in the chosen assignment. Be concise and
provide references to external sources if necessary. Include an evaluation/discussion of your experience
in an argumentative form; refrain from expressing opinions.

This question has been answered.

Get Answer