From: | glen herrmannsfeldt <gah@ugcs.caltech.edu> |
Newsgroups: | comp.compilers |
Date: | Fri, 8 Jun 2012 22:31:31 +0000 (UTC) |
Organization: | Aioe.org NNTP Server |
References: | 12-03-012 12-03-014 12-06-008 12-06-010 12-06-013 12-06-014 |
Keywords: | design |
Posted-Date: | 09 Jun 2012 09:09:23 EDT |
Johann 'Myrkraverk' Oskarsson <johann@2ndquadrant.com> wrote:
(snip)
> Another point to make. Why do we assign from right to left? Is it in
> any way natural? What's wrong with
> a + b --> c "a plus b assigned to c"
> instead of
> c <-- a + b "c becomes a + b?"
Must not be so obvious, as it seems that assemblers I have worked
with have done it both ways. That is, LOAD or MOVE instructions
that load/move right to left or left to right.
> The more I think about it, I believe the former construct is a bit more
> natural since we read from left to right. However, I'd want to see or
> work on a non-trivial project in such a language to make up my mind.
It goes at least back to Fortran, I don't know it farther back
than that.
In BASIC, at least slightly modelled after Fortran, there is a keyword
LET for assignment, but it is optional on all systems that I know of.
10 LET C=A+B
There is, on the other hand, the Fortran ASSIGNed GOTO, and the
corresponding ASSIGN statement, which traces back all the way to
Fortran I, which is left to right.
ASSIGN 12 TO I
The verilog continuous assignment statement uses the assign
keyword, but assigns right to left.
Right to left seems at least slightly more convenient when trying to
find where a variable is changed you can follow down the left side.
> For an Arabic programming language, all bets are off.
Then there are the top to bottom asian languages.
-- glen
Return to the
comp.compilers page.
Search the
comp.compilers archives again.