license Go Report Card

basgo compiles BASIC-lang to Golang.

basgo compiles BASIC-lang to Golang. Then go build can translate the code to native executable binary.

Created by gh-md-toc


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
cd update-golang
sudo ./

For Windows systems, get the Go installer here:

Version 0.5 requires GCC

Versions up to 0.4 of 'basgo-build' compiler did not require GCC.

In version 0.5 the experimental support for graphics introduced GCC as requirement.


Install git for Windows

Install mingw64 to provide GCC for Windows

This is a quick recipe on how to install mingw64 on Windows.

  • Download x86_64-8.1.0-release-posix-sjlj-rt_v6-rev0.7z from:

  • Extract the folder 'mingw64' as c:\mingw64

  • Add c:\mingw64\bin to %PATH%

  • Test GCC:

Open CMD.exe and run 'gcc --version':

C:\Users\evert>gcc --version
gcc (x86_64-posix-sjlj-rev0, Built by MinGW-W64 project) 8.1.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO



If you don't want to hack the compiler, you can download a precompiled binary release here:

Install only the 'basgo-build' compiler

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

git clone
cd basgo
go get
go generate ./basparser
go install ./basgo-build

Full install for development

If you want to hack the compiler, perform a full build (including tests):

git clone
cd basgo

Run the Compiler

Run the script 'basc'

The utility 'basc' performs the full compilation steps automatically:

# On Linux
echo '10 print "hello world"' > hello.bas
basc hello.bas                            ;# compile hello.bas to ./hello/hello
./hello/hello                             ;# execute the resulting binary

rem On Windows
echo 10 print "hello world" > hello.bas
basc hello.bas                            ;# compile hello.bas to .\hello\hello.exe
.\hello\hello                             ;# execute the resulting binary

Run the compiler manually

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:


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

BASIC References

BASIC programs and games - A Collection Of 1980s Games - Star Trek - Few GW-BASIC games - BASIC Games - A page about GWBASIC Games & Other Programs - Classic Basic Games Page - Classic BASIC Games - BASIC Computer Games

BASIC documentation - GW-BASIC User's Guide - GW-BASIC User's Guide - Operators - Language Guide - SINCLAIR ZX SPECTRUM - BASIC Programming

BASIC interpreters and compilers - GW-BASIC emulator - BASIC interpreter in Golang

2D Graphics Packages - UI toolkit - 2D game library - 2D rendering only, does not send to screen