CodingTrain / CodingTrain/Nebula-AppleSoft-Basic

snake_expanded.a: Line 7010: LE THEN parsed as LET HEN

Open
#9 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
BASIC
Stars
51
Forks
14
PR merge metrics
No merged PRs in 30d

Description

Was the code written and/or tested on a real physical Apple II only, or was an emulator also used?

Using `LE` as a variable name causes issues with the parsing and becomes `LET HEN` when `LIST`ed. I have only tested this on a number of emulators and the result is the same - however, I can't test this on a physical machine (as I don't have access to one).

I *assume* that you didn't see this issue, because you tested it on a physical machine rather than an emulator (strange I know and they should both be the same) and on the physical machine the issue did not manifest itself?

Please see [Does AppleSoft BASIC really parse "LE THEN" as "LET HEN"?](https://retrocomputing.stackexchange.com/q/31413/202).

[![LET HEN][1]][1]

### Solution

As pointed out by [this comment](https://retrocomputing.stackexchange.com/questions/31413/does-applesoft-basic-really-parse-le-then-as-let-hen/31416?noredirect=1#comment114079_31416), the change was made here, [#1 Change buffer to be used like a ring buffer. #5](https://github.com/CodingTrain/Nebula-AppleSoft-Basic/pull/5/files) and this [Update snake.a #8](https://github.com/CodingTrain/Nebula-AppleSoft-Basic/pull/8) states that the calormen JS emulator was used, which seems to have [a parsing bug](https://retrocomputing.stackexchange.com/a/31416/202), see [LE THEN GOTO should be parsed as LET HEN GOTO #51](https://github.com/inexorabletash/jsbasic/issues/51).

The fix is to use parentheses around the `LE`, changing

```none
7010 IF LS > LE THEN GOTO 7060
```

to

```none
7010 IF LS > (LE) THEN GOTO 7060
```

##### Alternative fixes

```none
7010 IF LE < LS THEN GOTO 7060
```

or

```none
7010 IF LS > LE GOTO 7060
```

Now the code will work on a real Apple II!
:-)

[1]: https://i.sstatic.net/2nRW1cM6.png "LET HEN"

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.