An open API service indexing awesome lists of open source software.

https://github.com/dps/toybasic

A toy basic compiler playground
https://github.com/dps/toybasic

Last synced: 10 months ago
JSON representation

A toy basic compiler playground

Awesome Lists containing this project

README

          

# toybasic

This is a toy compiler for a simple dialect of BASIC in golang. It's written in Go and it generates (ugly!) Go code.
I made this just for fun. The code is pretty short and hopefully easy to read. I hope you enjoy it too.

Example program `example/hello.bas`
```VB
10 PRINT "Hello, world."
20 LET x = (3 * 2) + 3
30 LET x = x + 1
40 IF x == 10 THEN PRINT "Ten!"
45 PRINT x
50 IF x >= 15 THEN GOTO 70
60 GOTO 30
70 END
```
Example output
```
$ ./toybasic