Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/twlite/qbasic

QBasic compiler that runs on node.js
https://github.com/twlite/qbasic

compiler node qbasic

Last synced: 26 days ago
JSON representation

QBasic compiler that runs on node.js

Awesome Lists containing this project

README

        

# QBasic.js

QBasic.js allows you to use **[qb.js](https://github.com/smhanov/qb.js)** inside node projects.

# Example

## CLI

```sh
$ npx qbasic --source=filePath.bas
```

`index.js`
```js
const { compileFile } = require("qbasic");
const fs = require("fs");

const { bytecode } = compileFile("./demo.bas");
fs.writeFileSync("./bytecode.txt", bytecode);
```

`demo.bas`

```basic
CLS
PRINT "Hello from QBasic"
END
```

`bytecode.txt`

```txt
' L1 CLS
syscall CLS
' L2 PRINT "Hello from QBasic"
pushconst Hello from QBasic
syscall print
pushconst

syscall print
' L3 END
end
ret
end
```