skx / gobasic

A BASIC interpreter written in golang.

Home Page:https://blog.steve.fi/tags/basic/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider implementing DATA + READ

skx opened this issue · comments

We could scan the program for DATA-statements at load-time, much like we do for line-numbers. Assume our Interpreter object had:

    dOffset := 0
    data = []int

Every time we see READ we just return the next value, it is (obviously) a fatal error to read too much.

Sample program(s) here:

NOTE: Because READ needs a reference to variables we have to put it in our core. Similarly DATA needs to be in our core.