skx / gobasic

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

41 print builtin #44

Closed skx closed 5 years ago

skx commented 5 years ago

This pull-request moves PRINT from our core-interpreter (eval/eval.go) into a built-in (eval/builtins.go), which will close #41.

This required some changes, because registering a built-in requires that you specify the number of arguments that they will consume - and PRINT consumes everything up to:

There is a regression though, which needs to be handled, print should output " " when it sees a COMMA, but the commas are consumed by the argument-buildup.

I'll merge this when that is handled, even if badly.