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

INPUT primitive could be improved #68

Closed skx closed 5 years ago

skx commented 6 years ago

The following program should prompt the user for input, but does not work as expected:

   10 LET a = "Enter your name:"
   20 INPUT a, b$
   30 PRINT "Hello ", b$, "\n"

Instead the prompt is "a":

    $ ./gobasic t.bas 
    asteve
    Hello  steve 

The problem is that the INPUT statement assumes the first argument is a string, and prints the literal-body of that string. We should handle (string) variables too!

skx commented 6 years ago

If somebody wishes to have a stab at this I'll look at their work early next week. If it remains open for >= 4 days I'll self-assign :)