Page 1 of 1

AppleSoft Basic Interpreter Project

Posted: Thu Sep 04, 2025 4:28 am
by Hutchboy
Hi,

I have been enjoying working on the LOGO parser and it inspired me to look at an AppleSoft Basic interpreter that I started over a year ago without too much success. The attached files include a fairly well-along AppleSoft Basic interpreter and a file of test programs that all work. Most of the explanation of what is going on is in the stack script header.

Once I have the rest of the text-based commands working I will start work on implementing Apple IIe graphic modes (I also want to include SHR modes like on the IIGS and what I think a IIGS+ with a 65832 processor may have been capable...why not?)

It is far enough along I thought it might be of interest.

-Mike

[ 9/6: Updated version v2.4 posted below, see stack script header for version history. Added many test programs and 2 demos.

Re: AppleSoft Basic Interpreter Project

Posted: Thu Sep 04, 2025 2:03 pm
by dunbarx
Mike.

Hard for me to understand what this rather hefty stack does. Can you give a short tutorial?

Craig

Re: AppleSoft Basic Interpreter Project

Posted: Fri Sep 05, 2025 12:15 am
by bobcole
Mike:
Another supreme effort! I enjoyed the test programs.
The answer to Test #3, however, does not seem correct.
It should go to Line 50 but, instead, it goes to Line 30 and prints FAIL.
Otherwise, the test programs were all sucessful.
What a project!
Bob

Re: AppleSoft Basic Interpreter Project

Posted: Fri Sep 05, 2025 4:45 am
by Hutchboy
Craig,

The stack is an AppleSoft Basic Interpreter. It will eventually be able to run most AppleSoft Basic programs. When I am to the point where I can run interesting demos I will add those as a kind of tutorial. In the meantime Google "online AppleSoft Basic" and you will see examples of really good interpreters.

Bob,

Thanks. In the test programs I think I need to remove any semi-colon comments at the top line and just run the actual line numbers. Right now I am much farther along and am working onv2.3. Here is my roadmap:

v2.3 — Control-flow enrichments
ON GOTO / ON GOSUB
STOP / CONT scaffolding

v2.4 — INPUT upgrades
Multiple targets: INPUT "Prompt"; A, B$, C(I) with comma parsing & coercion, quoted strings respected.
Array targets allowed; graceful handling of too few/many inputs in one line.
Smoke tests: mixed numeric/string/array, empty input → default, whitespace/quotes, extra commas.

v2.5 — Core functions (minimal but useful)
Numeric: INT, ABS, SGN, SQR, RND (with RND(0), RND(1), RND(n) semantics).
String: LEN, LEFT$, RIGHT$, MID$, ASC, CHR$, VAL, STR$.

v2.6 — PRINT utilities

v2.7 — Polishing & Demo Time

v2.8+ — Graphic Modes, PEEKS & POKES, Kitchen Sink Demos

-Mike

Re: AppleSoft Basic Interpreter Project

Posted: Sun Sep 07, 2025 1:15 pm
by Hutchboy
Hi,

Just a short note that I posted an update to the AppleSoft BASIC interpreter in the first entry in this subject. This is v2.4 and I am currently well into v2.5 on my roadmap.

Also, I want to note that, for you tinkers, you can paste a copy of the stack script into a brand new stack, then type "preOpenStack" in the message box, and it will generate a duplicate of the v2.4 stack except the user interface layout will be slightly different ( I haven't incorporated my latest UI tweaks into the "createUI" handler section yet). You can easily change to a different color scheme or revise the layout as long as you don't break the naming conventions.

- Mike