KrellStudios
  • © 2024 KrellStudios Contact Me 0

KrellStudios

A LiveCode AppleSoft BASIC Interpreter

Creating an AppleSoft BASIC Interpreter in LiveCode
================================================

This project implements a historically faithful AppleSoft BASIC interpreter entirely in LiveCode. The goal has been accuracy first: preserving original AppleSoft semantics, execution order, and edge cases rather than modernizing behavior.

[For an in depth look at this project follow this link: "An In Depth Look…"]

Key Architectural Points
------------------------
• Tokenization is performed early and aggressively, producing a normalized token stream that isolates keywords, symbols, variables, and string literals.
• Expressions are evaluated using a three-stage pipeline: token stream Shunting Yard (RPN) stack-based evaluator.
• AppleSoft-specific operators and behaviors (such as integer division, unary minus, and boolean truth as -1) are preserved explicitly.
• Control flow (GOTO, GOSUB, FOR/NEXT, IF/THEN) is managed through explicit interpreter state rather than relying on host language flow.
• Errors are centralized and reported with AppleSoft-correct codes, timing, and line numbers.
• INPUT, DATA/READ/RESTORE, arrays, and DEF FN functions follow AppleSoft’s original semantics, including unintuitive edge cases.

Interpreter Design Philosophy
-----------------------------
The interpreter favors correctness and determinism over convenience:
• AppleSoft quirks are implemented deliberately.
• Token hygiene is enforced at every stage.
• Execution is cooperative and UI-safe using deferred execution.
• Regression tests are used to lock behavior and prevent semantic drift.

Current Status
--------------
Version 2.9.3 marks the freeze of all non-graphics features. The interpreter now supports the complete AppleSoft BASIC language set for text-mode programs and has passed extensive regression and smoke testing.

Next Phase
----------
The next major version (v3.x) will focus on AppleSoft graphics support, including screen modes and drawing primitives. The current interpreter serves as the stable foundation for that work.

Links: The current version is available at: https://github.com/mdroberts2017

AppleSoft BASIC Interpreter