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

Better error-handling. #86

Closed skx closed 5 years ago

skx commented 5 years ago

Since LET is currently optional (I might reconsider, and #80 does make a good case) this should show an error:

10 A = 3

It does not:

 frodo ~ $ cat t.bas 
 10 A = 3

 frodo ~ $ gobasic t.bas 
 frodo ~ $

 frodo ~ $ gobasic -trace=true t.bas 
 RunOnce( Token{Type:LINENO Value:10} )
 RunOnce( Token{Type:IDENT Value:A} )
 RunOnce( Token{Type:INT Value:3} )

Here it is calling RunOnce with an IDENT token - which then gets evaluated via the default branch and results in no-error (which is a surprise).

skx commented 5 years ago

Reported as it happened, indirectly in #85.