{"id":24042440,"url":"https://github.com/jichu4n/qbjc","last_synced_at":"2025-04-19T20:45:38.596Z","repository":{"id":46307187,"uuid":"319394919","full_name":"jichu4n/qbjc","owner":"jichu4n","description":"QBasic to JavaScript compiler","archived":false,"fork":false,"pushed_at":"2025-03-17T20:49:19.000Z","size":82745,"stargazers_count":19,"open_issues_count":5,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T13:12:19.733Z","etag":null,"topics":["compiler","javascript","qbasic","quickbasic"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jichu4n.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-07T17:31:21.000Z","updated_at":"2025-03-04T07:17:40.000Z","dependencies_parsed_at":"2024-12-24T03:28:36.235Z","dependency_job_id":"f1ab6a8b-ae23-4b08-9882-57f0b4b7faaf","html_url":"https://github.com/jichu4n/qbjc","commit_stats":{"total_commits":241,"total_committers":2,"mean_commits":120.5,"dds":0.004149377593360981,"last_synced_commit":"473b6e3d9f04769381841f528e5f3edb059e9894"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jichu4n%2Fqbjc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jichu4n%2Fqbjc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jichu4n%2Fqbjc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jichu4n%2Fqbjc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jichu4n","download_url":"https://codeload.github.com/jichu4n/qbjc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249795887,"owners_count":21326780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compiler","javascript","qbasic","quickbasic"],"created_at":"2025-01-08T22:55:28.833Z","updated_at":"2025-04-19T20:45:38.577Z","avatar_url":"https://github.com/jichu4n.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NPM Version][npm-version-image]][npm-url]\n[![Build Status][build-status-image]][github-url]\n\n# qbjc\n\n**qbjc** is a QBasic to JavaScript compiler. It can compile a QBasic /\nQuickBASIC program to:\n\n- A standalone executable Node.js script, with zero external dependencies; or\n- An ES6 module that can be imported and executed in both Node.js and browser environments.\n\nTry it out in the browser: [👉 **qbjc.dev** 👈](https://qbjc.dev)\n\n## But why?\n\nQBasic was my first introduction to programming as a kid back in the 90s.\nDespite its many limitations, it really inspired my passion for building things\nwith technology that continues to this day. The balance of simplicity and power\nmade programming feel both approachable and incredibly fun [1].\n\nI wanted to see if I could recreate a little bit of that magic for the modern\nage, something easy to get started with in today's web-centric world. So this\nproject was born - a QBasic compiler + runtime + basic web IDE that compiles\nyour QBasic code to JavaScript!\n\n[1] See also: [30 years later, QBasic is still the\nbest](http://www.nicolasbize.com/blog/30-years-later-qbasic-is-still-the-best/)\n\n## Usage\n\n### qbjc playground\n\nThe qbjc playground\n([👉 **qbjc.dev** 👈](https://qbjc.dev))\nallows you to edit and run QBasic / QuickBASIC programs directly in the browser,\nno installation required.\n\n![qbjc playground screenshot](./docs/assets/playground.jpg)\n\n### Command line usage\n\n```bash\n# Install qbjc from NPM\nnpm install -g qbjc\n\n# Compile hello.bas and write output to hello.bas.js\nqbjc hello.bas\n\n# Run the compiled program\n./hello.bas.js\n\n# ...or run hello.bas directly:\nqbjc --run hello.bas\n\n# See all command line options\nqbjc --help\n```\n\n![Compiling and running a simple program](./docs/assets/hello.gif)\n\n### API usage\n\nCompiling a QBasic program:\n\n```TypeScript\nimport {compile} from 'qbjc';\n\n...\nconst {\n  // Compiled JavaScript code.\n  code,\n  // Sourcemap for the compiled JavaScript code.\n  map,\n  // Abstract syntax tree representing the compiled code.\n  astModule,\n} = await compile({\n  // QBasic source code.\n  source: 'PRINT \"HELLO WORLD\"',\n  // Optional - Source file name (for debugging information).\n  sourceFileName: 'hello.bas',\n  // Optional - Whether to bundle with Node.js runtime code in order\n  // to produce a standalone script.\n  enableBundling: false,\n  // Optional - Whether to minify the output.\n  enableMinify: false,\n});\n```\n\nExecuting the compiled code:\n\n- In browsers (using [xterm.js](https://xtermjs.org/)):\n\n  ```TypeScript\n  import {Terminal} from 'xterm';\n  import {BrowserExecutor} from 'qbjc/browser';\n\n  // Set up xterm.js Terminal instance\n  const terminal = new Terminal(...);\n\n  await new BrowserExecutor(terminal).executeModule(code);\n  ```\n\n- In Node.js:\n\n  ```TypeScript\n  import {NodeExecutor} from 'qbjc/node';\n\n  await new NodeExecutor().executeModule(code);\n  ```\n\n- In Node.js with bundling enabled (i.e. compiled with `enableBundling: true`):\n  ```TypeScript\n  import {run} from './hello.bas.js';\n  await run();\n  ```\n\n## Compatibility\n\n### What works:\n\n- Core language features\n\n  - Control flow structures - loops, conditionals, `GOTO`, `GOSUB` etc.\n  - Data types - primitive types, arrays and user-defined types (a.k.a. records)\n  - Expressions - arithmetic, string, comparison, boolean\n  - `SUB`s and `FUNCTION`s\n  - `DATA` constants\n  - Many built-in commands and functions like `VAL`, `STR$`, `INSTR`, `MID$`\n\n- Text mode\n\n  - Basic text mode I/O - `PRINT`, `INPUT`, `INKEY$`, `INPUT$` etc.\n  - Text mode screen manipulation - `COLOR`, `LOCATE` etc.\n  - Note that the current implementation depends on a VT100-compatible terminal emulator.\n    - On Windows, this means using WSL or something like PuTTY.\n    - In the browser, the implementation uses [xterm.js](https://xtermjs.org/).\n\n- It's just enough to run the original [`NIBBLES.BAS` game](./playground/examples/nibbles.bas) that shipped with QBasic:\n  ![Compiling and running NIBBLES.BAS](./docs/assets/nibbles.gif)\n\n### What doesn't work (yet):\n\n- Graphics and audio\n- Events - `ON ERROR`, `ON TIMER` etc.\n- OS APIs like file I/O, `CALL INTERRUPT` etc.\n- Direct memory access - `PEEK`, `POKE` etc.\n- Less common syntax, inputs or options\n- ...and more - contributions are welcome!\n\nFor detailed compatibility information on individual commands and functions, see\n[👉 Implementation Status](https://airtable.com/shrITVmjepv00kwpT).\n\n## About\n\nqbjc is distributed under the Apache License v2.\n\n[npm-url]: https://npmjs.org/package/qbjc\n[npm-version-image]: https://badgen.net/npm/v/qbjc\n[github-url]: https://github.com/jichu4n/qbjc\n[build-status-image]: https://github.com/jichu4n/qbjc/actions/workflows/build.yaml/badge.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjichu4n%2Fqbjc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjichu4n%2Fqbjc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjichu4n%2Fqbjc/lists"}