A Dartmouth BASIC language clone, interpreter REPL and "Transpiler" to Go, written in Go Lang.
disclaimer: 80 % Vibe coded, 10% love of programming, 10% coffee.
-
Phase 1 BASIC REPL in GoLang: AbacusAI-- Claude Sonnet 4.5; couldn't quite get it right, but laid the ground work for the REPL.
-
Phase 2 BASIC and Troubleshooting: AbacusAI Claude Sonnet 4.5; coding BASIC and troubleshooting in Go
-
Phase 3 GoLang and Troubleshooting: GPT-5.1 Codex, mostly built the compiler, not happy with this but it works.
- Classic BASIC syntax with line numbers
- Supported statements:
PRINT- Output text and expressionsLET- Variable assignmentIF...THEN...ELSE- Conditional executionFOR...TO...STEP...NEXT- LoopsGOTO- Jump to line numberGOSUB/RETURN- SubroutinesINPUT- User inputDIM- Array declarationREM- CommentsEND- End program
- Operators:
+,-,*,/,MOD,<,>,<=,>=,==,<>,AND,OR,NOT - Data types: Numbers and Strings
- Arrays with indexing
go build -o basic main.go./basic examples/hello.bas./basic -compile hello.go examples/hello.bas
go run hello.go./basic -compile hello.go examples/hello.bas && go build -o hello hello.go
./basicREPL commands:
RUN- Execute the programLIST- Show the programCLEARorNEW- Clear the programEXITorQUIT- Exit the interpreterSAVE <filename.bas>- Save code to diskLOAD <filename.bas>- Load code from diskDELETE n- Deletes a line number
10 PRINT "Hello, World!"
20 END10 FOR I = 1 TO 10
20 PRINT I
30 NEXT I
40 END10 INPUT "Enter your age: "; AGE
20 IF AGE >= 18 THEN PRINT "Adult" ELSE PRINT "Minor"
30 ENDSee the examples/ directory for more sample programs:
hello.bas- Hello Worldfibonacci.bas- Fibonacci sequenceguess.bas- Number guessing gamemultiply.bas- Multiplication tablegosub.bas- Subroutine example