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

Improve the handling of builtins #27

Closed skx closed 6 years ago

skx commented 6 years ago

This will allow us to handle recursive calls to built-ins in the future, so for example:

10 LET a = RND RND 100

The first RND will take the result of the second RND as argument. Similarly we can use this in goserver:

10 COLOR RND 255, RND 255, RND 255.
skx commented 6 years ago

Almost there :)

Next obvious thing to change is that the builtin-functions return:

object.Object, error

Since object.Object can now return an error (as result of #22) the second parameter is redundant. Drop it.

skx commented 6 years ago

Fix the tests tomorrow, then it's a go I think.