CodingTrain / CodingTrain/Nebula-AppleSoft-Basic
snake_expanded.a: Line 7010: LE THEN parsed as LET HEN
- Lenguaje dominante
- BASIC
- Estrellas
- 51
- Forks
- 14
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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"
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza en la línea 7010 de snake_expanded.a y compara la condición indicada con el comportamiento de análisis de AppleSoft BASIC descrito en el issue. Verifica la línea corregida listando o ejecutando el programa en un entorno o emulador de AppleSoft BASIC; se considera terminado cuando ya no aparece como “LET HEN” y funciona en un Apple II real.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Área
- compilers
- Tipo de issue
- Error
- Dificultad
- 1/5
- Tiempo estimado
- Menos de una hora
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 35/100