Questions related to the parsing (and possibly the evaluation) of free-form mathematical expressions in strings, lists, or streams

learn more… | top users | synonyms

4
votes
1answer
24 views

Reverse Polish Notation Calculator

Working through Learn You a Haskell, I made a Reverse Polish Notation calculator. Please critique it. ...
4
votes
1answer
32 views

Basic Reverse Polish CL Parser

K and R Exercise 5-10 Write the program expr, which evaluates a reverse Polish expression from the command line, where each operator or operand is a separate argument. For example, ...
2
votes
2answers
484 views

RPN Evaluator that writes the results to a text file

For homework, I had to write an RPN Evaluator and write the results to a text file. I've done all that, but it feels weird, like the writing to my results text file. It also doesn't feel efficient. ...
7
votes
4answers
556 views

Simple C++ calculator which follows BOMDAS rules

This was my first attempt at making a C++ calculator. The user basically inputs an expression (I'll use \$1+1*(9*(11-1))\$ as an example) and the program searches for and creates a vector for ...
2
votes
1answer
117 views

Advanced Calculator Kata

This is the CalculatorAdvanced Kata from the Kata gem. I've just finished it and would love some feedback on my solution. ...
3
votes
3answers
813 views

RPN-Stack-Based Recursive Calculator Needs Tuneup

This function takes an array of strings and numbers and recursively processes it as a kind of "calculating program". The structure is based on Reverse Polish Notation, so the top object in the stack ...
1
vote
3answers
534 views

Calculating postfix notation using two forms of input

My postfix program essentially allows the user two input options to calculate a postfix equation: Confirmations after each input (after an input, the user is ask for another number, operator, or ...
2
votes
1answer
466 views

Calculator parsing S-expressions

The following program is supposed to be a (command line) calculator that parses expression following syntax similar to Lisp's S-expressions. Some examples: $ echo "(+ 5 5)" | ./a.out ...
5
votes
4answers
4k views

Reverse polish notation interpreter/calculator

Just for the heck of it, I wrote a simple little interpreter that takes in inputs in the reverse polish notation. The user will input something like + 5 6 ...
6
votes
2answers
312 views

Cleaning up Reverse Polish Notation evaluator

I was wondering if anyone had some general clean up advice on my code. I believe that more helper functions would be my case but I could be wrong. 30 lines maximum per method is my rule. I can't seem ...
3
votes
1answer
111 views

Refactoring calculator expression

I was doing a simple exercise to calculate the amount based on an expression. For example: (((2*2)+(3*5/5)+(2*5))) outputs 17 ...
7
votes
1answer
244 views

Command line reverse polish calculator

Write the program expr, which evaluates a reverse Polish expression from the command line, where each operator or operand is a separate argument. For ...
3
votes
1answer
164 views

Math Equation as String to Reverse Polish Notation Parser

What I have done is create a console program where users type in a math equation such as 5+4-6 or (5+16(8-4))/16 that follows ...
3
votes
0answers
59 views

Parsing an infix notation expression and converting to reverse polish notation

I'm pretty new to Go, and I do not know the best or idiomatic ways to do most of the stuff, so I'd appreciate feedback on how to make my code better, faster or more idiomatic. My program is a set of ...