473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Anyone got an infix to postfix (RPN) math notation converter?

Anyone got an infix to postfix (RPN) math notation converter?
I've looked around a bit and haven't found anything quite what I want.

I just want a method that will take a string in infix notation and return a
string in Reverse Polish Notation.
Jan 12 '06 #1
6 5545
Should be pretty easy to build. All you have to do is to build a parser
that takes precedence into account...

"PIEBALD" <PI*****@discussions.microsoft.com> wrote in message
news:8E**********************************@microsof t.com...
Anyone got an infix to postfix (RPN) math notation converter?
I've looked around a bit and haven't found anything quite what I want.

I just want a method that will take a string in infix notation and return
a
string in Reverse Polish Notation.

Jan 12 '06 #2
"Gabriel Magaña" <no*****@no-spam.com> wrote in message
news:eN**************@tk2msftngp13.phx.gbl...
Should be pretty easy to build. All you have to do is to build a parser
that takes precedence into account...


....and constants (integer, float, scientific notation), unary operators,
binary operators (left->right, right->left), parentheses, etc. This can be
a real project depending on how much is expected.

-- Alan
Jan 12 '06 #3
I don't need it to evaluate the expression, just transform it.
Jan 12 '06 #4
> ...and constants (integer, float, scientific notation), unary operators,
binary operators (left->right, right->left), parentheses, etc. This can
be a real project depending on how much is expected.


Hehe! When I was in college I pulled an all nighter building something
exactly like this... Ah the good ol' days!
Jan 12 '06 #5
"PIEBALD" <PI*****@discussions.microsoft.com> wrote in message
news:E2**********************************@microsof t.com...
I don't need it to evaluate the expression, just transform it.


No less work, really, just a little different. Parsing is the same whether
evaluating or transforming. Search the web for recursive descent parsing.

-- Alan
Jan 12 '06 #6
> Hehe! When I was in college I pulled an all nighter building something
exactly like this... Ah the good ol' days!


Indeed, I did too in VAX Pascal. I don't even have the textbook anymore.
I have found some C++ code that I'll try to convert to C#.
Jan 12 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
5
by: KidLogik | last post by:
Hello! I am converting an infix expression string into a postfix so that I will be able to evaluate it easier -> (5*(((9+8)*(4*6))+7)) == 598+46**7+* I believe the rule is "Replace all...
22
by: Tony Johansson | last post by:
Hello Experts! I'm reading i a book about C++ and they mention infix with telling what it is. I hope you out there can do so. Many thanks! //Tony
19
by: caramel | last post by:
i've been working on this program forever! now i'm stuck and going insane because i keep getting a syntax error msg and i just can't see what the compiler is signaling to! #include <stdio.h>...
30
by: Xah Lee | last post by:
The Concepts and Confusions of Prefix, Infix, Postfix and Fully Functional Notations Xah Lee, 2006-03-15 In LISP languages, they use a notation like “(+ 1 2)†to mean “1+2â€....
3
by: jackikay | last post by:
how do i write a program that converts infix to postfix.?
6
by: jimmuel001 | last post by:
pls help me fo my assignment that will allow the user to input infinite equations in infix type. and will output in postfix. thanks!
1
by: aitia | last post by:
this the code. i used ECLIPSE to run this.. it has some codes smells that i can't seem to figure out.. can any one help? import java.io.*; import java.util.*; public class Postfix { private...
2
by: zeroeight | last post by:
Hi guys, I'm a newbie here, I just want to seek for help regarding my program. I want to implement an infix to postfix conversion only accepting numbers. Right now, I already debugged the errors...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.