skx / gobasic

A BASIC interpreter written in golang.
https://blog.steve.fi/tags/basic/
GNU General Public License v2.0
328 stars 27 forks source link

DEF FN should be processed at program-load time. #57

Closed skx closed 6 years ago

skx commented 6 years ago

Currently this is an error:

10 PRINT FN square(3), "\n" 20 DEF FN square(x) = x * x

This is an error because square only exists at the time it is encountered. We should parse definitions at the time we load the program - much like we do for processing DATA tokens.

This is a pain because there isn't a great solution, but we should handle it regardless.