A Simple Conversion
- Input: 3+4
- Add 3 to the output queue (whenever a number is read it is added to the output)
- Push + (or its ID) onto the operator stack
- Add 4 to the output queue
- After reading the expression pop the operators off the stack and add them to the output.
- In this case there is only one, "+".
- Output 3 4 +
This already shows a couple of rules:
- All numbers are added to the output when they are read.
- At the end of reading the expression, pop all operators off the stack and onto the output.
Read more about this topic: Shunting-yard Algorithm
Famous quotes containing the words simple and/or conversion:
“The prostitute is the scapegoat for everyones sins, and few people care whether she is justly treated or not. Good people have spent thousands of pounds in efforts to reform her, poets have written about her, essayists and orators have made her the subject of some of their most striking rhetoric; perhaps no class of people has been so much abused, and alternatively sentimentalized over as prostitutes have been but one thing they have never yet had, and that is simple legal justice.”
—Alison Neilans. Justice for the ProstituteLady Astors Bill, Equal Rights (September 19, 1925)
“The conversion of a savage to Christianity is the conversion of Christianity to savagery.”
—George Bernard Shaw (18561950)