Reviving my 40-year-old game. Originally published in Compute! magazine in 1984, the code originally targeted the Commodore VIC-20 and 64. The ultimate goal is to make it possible to play this game in a web browser.
As a typical geek, I'm more than willing to spend multiple times the effort required to solve the problem "manually" to solve it programmatically. In this case, the goal is to get things running without manually entering all of the code from the magazine into an emulator. That will require some effort, including:
Scan images of all of the code segmentsOCR those images, generate segments of BASIC and clean up resulting OCR issues- Create consolidated BASIC code based on the cleaned up OCR output with some minor tweaks for clarity
- Create tool to generate tokenized BASIC
- Decide on and implement a web-based emulator such as a WebAseembly compiled VICE instance.
Commodore BASIC code is stored in a tokenized form. In addition, the VICE emulator wraps an additional layer around this code. The code in the src/python folder implements a tokenizer that generates .P00
files that are loadable by the VICE emulator.
The BASIC language is parsed by an EBNF parser generator implemented by the Python TatSu parser generation library. Keyword-based tokenization implementations map the generated AST into the required BASIC tokens.