This question relates to thread "Languages with Optional Spaces".
In an Applesoft II manual I've found at "classiccmp.org" [1], page 7,
we read that in a variable name any alphanumeric characters after the
first two are ignored, unless they contain a reserved world. FEND ie
would be illegal as it contains END.
To implement such a rule one could first recognize keywords and then >recognize any names. We see in p123 that stmt I is tokenized as II:
I. stmt: 100 FOR A = LOFT OR CAT To 15
II. tokens: 100 FOR A = LOF TO RC AT To 15
Yet, I've found ie a program at "hoist-point.com" [2] that contains:
110 DIFF = ABS(A(I)-N)
Also, an online AppleSoft simulator at calormen.com [3] accepts ie both
DIFF and FEND as valid variable names.
As it seems, this issue can affect a design choice for the tokenization >phases of an Applesoft front-end. Is the manual just informative or the >online simulator does not accept (precisely) the particular dialect?
This question relates to thread "Languages with Optional Spaces".
In an Applesoft II manual I've found at "classiccmp.org" [1], page 7,
we read that in a variable name any alphanumeric characters after the
first two are ignored, unless they contain a reserved world. FEND ie
would be illegal as it contains END.
To implement such a rule one could first recognize keywords and then recognize any names. We see in p123 that stmt I is tokenized as II:
I. stmt: 100 FOR A = LOFT OR CAT To 15
II. tokens: 100 FOR A = LOF TO RC AT To 15
Yet, I've found ie a program at "hoist-point.com" [2] that contains:
110 DIFF = ABS(A(I)-N)
Also, an online AppleSoft simulator at calormen.com [3] accepts ie both
DIFF and FEND as valid variable names.
As it seems, this issue can affect a design choice for the tokenization phases of an Applesoft front-end. Is the manual just informative or the online simulator does not accept (precisely) the particular dialect?
"Ev. Drikos" <drikosev@gmail.com> writes:
...
Yet, I've found ie a program at "hoist-point.com" [2] that contains:
110 DIFF = ABS(A(I)-N)
If you type that into Applesoft BASIC, it parses it as:
110 D IF F = ABS (A(I) - N)
The spaces are how Applesoft lists it...
Also, an online AppleSoft simulator at calormen.com [3] accepts ie both
DIFF and FEND as valid variable names.
It is doing things differently than actual Applesoft.
As it seems, this issue can affect a design choice for the tokenization
phases of an Applesoft front-end. Is the manual just informative or the
online simulator does not accept (precisely) the particular dialect?
The latter; the simulator accepts a different dialect.
--
Also, an online AppleSoft simulator at calormen.com [3] accepts ie both DIFF and FEND as valid variable names.
It is doing things differently than actual Applesoft.
As it seems, this issue can affect a design choice for the tokenization phases of an Applesoft front-end. Is the manual just informative or the online simulator does not accept (precisely) the particular dialect?
The latter; the simulator accepts a different dialect.
Another vague point or simply a point where I'm not really sure that I translate properly the manual are the reserved keywords before a certain delimiter. Likely an Applesoft parser must reject this valid UK101 code:
10 X=SHIMEM:
20 END
There is a reason, BASIC compilers that remove spaces often restrict variables (like the original Basic version did) to a letter optionally followed by a digit (and a dollar sign to indicate strings). It makes
the lexing much simpler, even without spaces.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 296 |
Nodes: | 16 (2 / 14) |
Uptime: | 89:36:54 |
Calls: | 6,658 |
Files: | 12,203 |
Messages: | 5,334,031 |