AppleSoft Basic Interpreter Project

A place for you to show off what you have made with LiveCode

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Hutchboy
Posts: 128
Joined: Wed Aug 01, 2018 2:57 pm
Contact:

AppleSoft Basic Interpreter Project

Post by Hutchboy » Thu Sep 04, 2025 4:28 am

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.
Attachments
AppleSoft Basic Interpreter v2.4.0_ Build 090525.livecode.zip
(16.23 KiB) Downloaded 17 times
2. Working Demo Programs.zip
(2.89 KiB) Downloaded 19 times
1. Test Programs.zip
(30.88 KiB) Downloaded 16 times
Last edited by Hutchboy on Sun Sep 07, 2025 4:18 am, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10369
Joined: Wed May 06, 2009 2:28 pm

Re: AppleSoft Basic Interpreter Project

Post by dunbarx » Thu Sep 04, 2025 2:03 pm

Mike.

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

Craig

bobcole
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 169
Joined: Tue Feb 23, 2010 10:53 pm

Re: AppleSoft Basic Interpreter Project

Post by bobcole » Fri Sep 05, 2025 12:15 am

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

Hutchboy
Posts: 128
Joined: Wed Aug 01, 2018 2:57 pm
Contact:

Re: AppleSoft Basic Interpreter Project

Post by Hutchboy » Fri Sep 05, 2025 4:45 am

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

Hutchboy
Posts: 128
Joined: Wed Aug 01, 2018 2:57 pm
Contact:

Re: AppleSoft Basic Interpreter Project

Post by Hutchboy » Sun Sep 07, 2025 1:15 pm

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

Post Reply