[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: CiderPress v2.3.1 released
- Subject: Re: CiderPress v2.3.1 released
- From: pausch@saaf.se (Paul Schlyter)
- Date: Thu, 22 Dec 2005 07:43:33 GMT
- Newsgroups: comp.sys.apple2
- Organization: Unknown
- References: <439c8e87$0$81266$742ec2ed@news.sonic.net> <jLCdnaXfctDnsTTeRVn-rw@comcast.com> <doc9vk$1v61$1@merope.saaf.se> <-P2dnWPtcZ-MXzTenZ2dnUVZ_vydnZ2d@comcast.com>
- Xref: g2news1.google.com comp.sys.apple2:7923
In article <-P2dnWPtcZ-MXzTenZ2dnUVZ_vydnZ2d@comcast.com>,
Michael J. Mahon <mjmahon@aol.com> wrote:
> Paul Schlyter wrote:
>
> <snip>
>
>> Applesoft lax syntax checking also allowed some oddities, like:
>>
>> 20 IF A <=> B THEN .....
>>
>> Of course "A <=> B" always evaluated as "true" since every number is
>> always less than, equal to, or greater than, every other number.
>
> Ha! That's exactly what I would have expected, since that's
> actually a semantic check. Each additional relational just
> ORs with the previous ones, if any.
>
> -michael
Afair the Applesoft interpreter implemented the relational checks like
this:
When interpreting the relational operators, a small bitmap of 3 bits
was built, and each bit was set or cleared depending on whether each
of the < = > operators was present or absent: when a relational
operation was encountered, the corresponding bit in the bitmap was
set. This also offered a syntax check: if a relational operation was
encountered and the corresponding bit already was set, this meant that
the operation was encountered a second time, and this was treated as a
syntax error. Thus you cannot do things like "IF A <=<= B" in Applesoft.
(it would have been easy to also add a check if all the three bits of
the bitmap was set, and to also treat that case as a syntax error)
Next, the actual operations were compared. First a type check was made:
both operators (where each operator could be a constant, a variable, or
an arbitrary expression) had to be both strings or both numbers; trying
to compare a number to a string yielded a syntax error. Then the actual
comparison was done, and a similar 3-bit bit map was built, but with only
one bit set - which one depended on whether the first variable was less
than, equal to, or greater than, the second variable.
Finally, the two 3-bit bit maps were AND'ed with one another: if the AND
was non-zero, the result of the comparison was "true"; if it was zero,
the result was "false".
--
----------------------------------------------------------------
Paul Schlyter, Grev Turegatan 40, SE-114 38 Stockholm, SWEDEN
e-mail: pausch at stockholm dot bostream dot se
WWW: http://stjarnhimlen.se/