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

A server-mode would be fun #14

Closed skx closed 6 years ago

skx commented 6 years ago

The embedded example allows you to draw circles, points, etc. Using that as a template it seems like it would be near-trivial to write a HTTP-server which accepts a BASIC program, and returns the rendered image.

Wrap that in a HTML-page and you've got insta-gui.

For example this program is fun:

10 FOR x=0 TO 800
    20 LET y = x / 128 * PI
    30 LET y = 100 + ( 80 * SIN y )
40 DOT x,y
50 NEXT x
    70 SAVE

It produces the following graph:

out

Of course I'd need to add LINE, CIRCLE, and rename DOT to PLOT. But as a core idea I think it's probably simple to implement and somewhat useful.

Feedback welcome.