basgo compiles BASIC-lang to Golang
Branch: master
Clone or download
udhos
udhos Version up.
Latest commit 606cb09 Feb 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
basgo-build Improve TAB. Feb 14, 2019
basgo-run Trivial compiler. Dec 26, 2018
basgo Version up. Feb 15, 2019
baslex-run Lex shows current position. Dec 23, 2018
baslex-samples Unary not. Jan 13, 2019
baslex POS function: track screen column. Feb 14, 2019
baslib Improve TAB. Feb 14, 2019
basparser-run WHILE/WEND. Jan 25, 2019
basparser-samples Improve example. Jan 29, 2019
basparser POS function: track screen column. Feb 14, 2019
examples Fixes. Feb 15, 2019
gofunc _GOIMPORT and _GODECL can define Go functions directly in BASIC code. Feb 3, 2019
node trade.bas Feb 15, 2019
.gitignore Initial commit Dec 17, 2018
LICENSE Initial commit Dec 17, 2018
README.md toc. Feb 13, 2019
build.sh Move SGN implementation to package baslib. Feb 2, 2019
go.mod Non-blocking inkey. Feb 13, 2019
go.sum Non-blocking inkey. Feb 13, 2019
lint.sh

README.md

license Go Report Card

basgo compiles BASIC-lang to Golang

Requirements

In order to build the 'basgo-build' compiler, a recent version of Go is required.

If your system lacks Go, this recipe will install a current release of Go:

git clone https://github.com/udhos/update-golang
cd update-golang
sudo ./update-golang.sh

Install

The recipe below will install 'basgo-build' under "~/go/bin".

git clone https://github.com/udhos/basgo
cd basgo
./build.sh

Run the Compiler

basgo-build < program.bas > program.go
go run program.go                      ;# builds and runs program.go

Status and Limitations

The compiler currently can handle many simple programs.

Limitations include lack of support for sound, graphics and hardware-specific instructions (POKE, PEEK, etc).

See also known issues: https://github.com/udhos/basgo/issues

Example

basgo-build < examples/game.bas > game.go
go run game.go                            ;# builds and runs game.go

Sample - Hello World

$ echo '10 print "hello world!"' | basgo-build > a.go
$
$ go run a.go
hello world!
$

Use _GOFUNC to call Go function from BASIC code

_GOFUNC() is a BASIC keyword introduced by the 'basgo' compiler in order to call a Go function from BASIC code.

10 result = _GOFUNC("func_name", arg1, arg2, ..., argN)
20 print result

See gofunc

Run the Interpreter

Status: the interpreter currently can only parse simple programs, but is unable to execute anything.

# interpreter interactively reads from stdin
basgo-run

BASIC References

BASIC programs and games

http://www.dunnington.info/public/startrek/index.html - Star Trek

https://sparcie.wordpress.com/tag/gwbasic/ - Few GW-BASIC games

http://www.eddiesegoura.com/Games/ - BASIC Games

http://peyre.x10.mx/GWBASIC/ - A page about GWBASIC Games & Other Programs

http://www.ifarchive.org/indexes/if-archive/games/source/basic/

http://www.moorecad.com/classicbasic/index.html - Classic Basic Games Page

http://www.classicbasicgames.org/ - Classic BASIC Games

http://www.vintage-basic.net/games.html - BASIC Computer Games

BASIC documentation

https://hwiegman.home.xs4all.nl/gw-man/ - GW-BASIC User's Guide

http://www.antonis.de/qbebooks/gwbasman/ - GW-BASIC User's Guide

http://www.antonis.de/qbebooks/gwbasman/chapter%206.html - Operators

https://robhagemans.github.io/pcbasic/doc/1.2/#guide - Language Guide

BASIC interpreters and compilers

https://github.com/robhagemans/pcbasic - GW-BASIC emulator

https://github.com/skx/gobasic/ - BASIC interpreter in Golang