Anonymous user
Parsing/RPN to infix conversion: Difference between revisions
m
→{{header|REXX}}: aligned statements.
m (→{{header|REXX}}: added/changed whitespace and comments, used a template for the output section.) |
m (→{{header|REXX}}: aligned statements.) |
||
Line 3,403:
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
pop: pop= #;
push: #= # + 1;
/*──────────────────────────────────────────────────────────────────────────────────────*/
stack2str: $=; do j=1 for #; _ = @.j; y= left(_, 1)
Line 3,413:
return space($)
/*──────────────────────────────────────────────────────────────────────────────────────*/
toInfix: parse arg rpn; say copies('─', 80 - 1);
do N=1 for words(RPN) /*process each of the RPN tokens.*/
Line 3,429:
end /*N*/
return space( substr( pop(), 2) )</lang>
{{out|output|text= when using the default inputs: [Output is very similar to AWK's output.]}}
<pre>
|