Assignment Versus Equality

BartC bc at freeuk.com
Mon Jun 27 19:08:00 EDT 2016


On 27/06/2016 23:45, Lawrence D’Oliveiro wrote:
> On Tuesday, June 28, 2016 at 3:27:40 AM UTC+12, MRAB wrote:
>> On 2016-06-27 14:59, Grant Edwards wrote:
>>> Why would a language designer think it a good idea?
>>>
>> It let you have identifiers like "grand total"; there was no need for
>> camel case or underscores to separate the parts of the name.
>
> Another nifty thing (well, I thought so at the time) was that FORTRAN had no reserved words.
>
> Though I wondered, in statements like
>
>     FORMAT(...complex expression with lots of nested parentheses...) = ...
>
> how much work the parser would have to do before deciding that it was an array assignment, not a FORMAT statement?

You just design the compiler to do the same processing in each case, ie. 
parse a <name> followed (<expression>), then mark the result AST 
fragment as either an Array term, or Format statement, depending on what 
follows, and whether the name is "format".

I suppose the compiler could decide to backtrack and re-parse based on 
the knowledge that is one or the other, but that's a messy way of doing it.

-- 
Bartc



More information about the Python-list mailing list