PDA

View Full Version : An interactive BASIC interpreter implemented in Python 3



richpl
August 13th, 2019, 09:53 AM
If this is of interest to anyone, Iíve written a BASIC interpreter in Python. This started as a personal project, but I mention it here as Iíve put quite a lot of work into it and the implementation is non-trivial. I think Iíve done a reasonably elegant and well structured piece of work. Error checking is comprehensive and error reporting should at least allow the user to narrow down which line of their BASIC program is invalid.

Iíve implemented all of the major control structures as well as numeric and string variables. There is also support for numeric and string arrays.

The interpreter is interactive in the style of a 1980s home computer (which was my introduction to programming, via the TI99/4a, RML 380Z and BBC Micro). At the prompt you may enter unstructured BASIC statements to create a program, run, list and save it, as well as load previously written BASIC programs. Given that it is written in Python 3, the interpreter should run on multiple platforms.

The interpreter is available for free in Github using this link: https://github.com/richpl/PyBasic.

Chuck(G)
August 13th, 2019, 10:03 AM
Does Python 3 exist for Z80 or 8088?

richpl
August 13th, 2019, 10:55 AM
Nope, but I hope the interpreter will enable those without access to one of those old architectures to experience what it was like programming them using BASIC.

tipc
August 13th, 2019, 11:13 AM
Interested when time and energy permits.

Clearly you wanted to see the end.result. But was this an.exercise.in Python? What about building a 64 bit basic interpreter outright?

richpl
August 13th, 2019, 02:26 PM
An exercise in interpreter writing primarily, and I can write Python. My C is too rusty to write anything which runs natively.