Re: Stack-based syntax (was: affixes)
From: | Mark J. Reed <markjreed@...> |
Date: | Thursday, February 24, 2005, 19:04 |
On Thu, Feb 24, 2005 at 06:34:21PM +0000, Ray Brown wrote:
> >And certainly there must be some "lexical" information in the - and ÷
> >operators, which enforce an ordering on their operands?
>
> In the case of + the ordering is irrelevant, tho in the case of - it is
> not. But the ordering is surely the result of stack structure itself, not
> the operator per_se.
Right. Now consider a system which has only + and ×, but also has
a unary NEGATE and a unary INVERT. Then those latter two would be
the equivalent of the unary case markers I mentioned:
3 2 NEG + = 1
3 NEG 2 + = -1
On the other hand, if there were no such operators but literals could be negative
or fractional, then
3 -2 + = 1
-3 2 + = -1
And now you have the case marking within the operand itself.
> The literal 5 is of the same type as 3 and 2; the notion of
> additionality is not there in the resultant evaluation. But when a
> Fithian verb operates upon its arguments, surely the meaning of the
> verb forms part of the resultant meaning?
Sure, but this is really a use/mention distinction that is based on
only one possible process in the arithmetic example. So change what we're
doing - instead of evaluating the expression, let's transform it to
infix. The stack then holds infix expressions, not just numbers:
1 2 + 3 - 4 × 5 ÷
push 1, push 2, pop 2, pop 1, push (1 + 2), push 3, pop 3, pop (1+2),
push ((1 + 2) - 3), push 4, pop 4, pop ((1 + 2) - 3), push
(((1 + 2) - 3) × 4), push 5, pop 5, pop (((1 + 2) - 3) × 4), push
((((1 + 2) - 3) × 4) ÷ 5). That's a better analogue to the mental
translation of RPNglish to English in my original message.
-Marcos
Reply