{"_id":"wwwbasic","_rev":"4-4e6ec958e0d3f62d9cd7ac7a71c49f7d","name":"wwwbasic","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"wwwbasic","version":"1.0.0","keywords":["BASIC"],"author":{"url":"http://flagxor.com/","name":"Brad Nelson","email":"flagxor@gmail.com"},"license":"Apache-2.0","_id":"wwwbasic@1.0.0","maintainers":[{"name":"flagxor","email":"flagxor@gmail.com"}],"homepage":"https://github.com/google/wwwbasic#readme","bugs":{"url":"https://github.com/google/wwwbasic/issues"},"dist":{"shasum":"ca969a3139bbcd01e1a3cd3ebcdbe561f8983883","tarball":"https://registry.npmjs.org/wwwbasic/-/wwwbasic-1.0.0.tgz","fileCount":5,"integrity":"sha512-xUxN7Dw+2OfO+7L1W/gSq+FyTRBFzwj5kgEclPMrqt5H3FBnK4aCHWkHY1mWbFnECTPruVsZ0FAf1Mo+yPo9WQ==","signatures":[{"sig":"MEUCIHZNKyodXqSCPIHiXrQT2NQNOshX1qL3MN066Gh/SPfvAiEA9nUORKPKXA/1nDsVFtw+rqG+tFQAIrdQp0XsIXv+DuU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":115481,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbo2QCCRA9TVsSAnZWagAAWGQQAJND4DNynqFbzLRnJC0S\namD+1J2dVmnnvccJHCB5QB3/+bpJ1Hjy4Sx8UByxPxhgJL9LXuRVwti9e/kG\nuqUUvwgpJhEDFs60FHQKTSU0QMS74NFZ+Ukcuz6/QX0J855Hzw5gvf+1Jps3\nKvbACkEXldpLWBMzg4DpY0BnIOyWlG1Gnqh18MFuQeLdNm4/Pw8iZdql4JZ+\nxtnQzJ5ZFLpSkl37zglrv3K60Xw34rQVc54ZlsLlsBvUp5Gi3lA4/24piwMI\nLy88INyMEQnXzJuBeGGx08Ay6GkM+wc/pLX7TCAkGN/5UZFs7sx+Ye7aI8CO\nHy/IXzcaQwT3qFp8EBX+vAvUi8hgfP+v/gWw21XpcEIALKao1mreJxy2I78y\nq8H49c/Vk+5DV6G9ppHDp81bW05Y07QLf9nwJN5tA//YLiHCfY/34j7Wn+TU\nnuikJStApcCuHsoHCwG5ICHClzv+iwkCDxQ7GxnUfcAJnx3c9HH8AhZOso86\npPWp/NmWHgUZ76k/Wdiq9Ln/82nDwvdJQxsXqa4txPTOHZ2YbE71akF8/Ql8\n9fry13xy5Vt3M0v1gDLC+i9n8LSRcWIsqkXWVbwZCipky5Hi3wbx/RKEsU4m\nmJH98IFarFWNbzOJSxxFOsOBRTsUf5DBcPAEXTq+Prh50gMelEv3rEcyKeWi\n7sIA\r\n=Snvt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"wwwbasic.js","gitHead":"3b27a47fc44024059ec7f331b9582eb8032cef06","scripts":{"test":"./run-tests.sh"},"_npmUser":{"name":"flagxor","email":"flagxor@gmail.com"},"repository":{"url":"git+https://github.com/google/wwwbasic.git","type":"git"},"_npmVersion":"6.2.0","description":"An implementation of BASIC designed to be easy to run on the Web","directories":{"test":"test","example":"examples"},"_nodeVersion":"10.9.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wwwbasic_1.0.0_1537434625528_0.7691098760635477","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"wwwbasic","version":"1.0.1","keywords":["BASIC"],"author":{"url":"http://flagxor.com/","name":"Brad Nelson","email":"flagxor@gmail.com"},"license":"Apache-2.0","_id":"wwwbasic@1.0.1","maintainers":[{"name":"flagxor","email":"flagxor@gmail.com"}],"homepage":"https://github.com/google/wwwbasic#readme","bugs":{"url":"https://github.com/google/wwwbasic/issues"},"dist":{"shasum":"00fa2046ab43b49c0823fdccf438618b4eca8ff2","tarball":"https://registry.npmjs.org/wwwbasic/-/wwwbasic-1.0.1.tgz","fileCount":5,"integrity":"sha512-yEbKdlI9FdiguIKol/X/Hsoxta6ohgetP7aPndK3MnpqgamgUwQXIsuW/e90x3PpbnCBaidHhOfudW9szIwRjg==","signatures":[{"sig":"MEUCIQCc49CK70kQzpKEJNzd3DqzMUCslXhTmqAjYskJCY8c9AIgfHQCdw/Sb7Rmjt7LNXVxblaiYCneQmxh/g5b4UPVkiQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":136261},"main":"wwwbasic.js","gitHead":"a3ffe1f041835696ff3503b709f4b42c0b8d8814","scripts":{"test":"./test/run-tests.sh"},"_npmUser":{"name":"flagxor","email":"flagxor@gmail.com"},"repository":{"url":"git+https://github.com/google/wwwbasic.git","type":"git"},"_npmVersion":"9.2.0","description":"An implementation of BASIC designed to be easy to run on the Web","directories":{"test":"test","tools":"tools","example":"examples"},"_nodeVersion":"20.19.2","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/wwwbasic_1.0.1_1771141067478_0.8666711614143214","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"wwwbasic","version":"1.0.2","description":"An implementation of BASIC designed to be easy to run on the Web","keywords":["BASIC"],"homepage":"https://github.com/google/wwwbasic#readme","bugs":{"url":"https://github.com/google/wwwbasic/issues"},"license":"Apache-2.0","author":{"name":"Brad Nelson","email":"flagxor@gmail.com","url":"http://flagxor.com/"},"main":"wwwbasic.js","directories":{"example":"examples","test":"test","tools":"tools"},"repository":{"type":"git","url":"git+https://github.com/google/wwwbasic.git"},"scripts":{"test":"./test/run-tests.sh"},"gitHead":"77ed2a8edef8d14ed2c968bc397d926ee476f4d6","_id":"wwwbasic@1.0.2","_nodeVersion":"20.19.2","_npmVersion":"9.2.0","dist":{"integrity":"sha512-TKwH6A0aI1V6FuaDEdKf84b2QjKfwi5vEsBMNEaduIMpvJ57pQjyPekWoCaPosQsKFPnin+xi4P06GGdcqfh0Q==","shasum":"53468493523a9822ebe840ecc234fdf72e9b03d2","tarball":"https://registry.npmjs.org/wwwbasic/-/wwwbasic-1.0.2.tgz","fileCount":6,"unpackedSize":250590,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHMQaVOUmrWqSO4eweS2qqqx/z43+vPe7s5nycwAPTbMAiEA2l3X8Xt0jbfWCuPIHL7Gq/k6Bd8CCTGMN/oOnhWUiRk="}]},"_npmUser":{"name":"flagxor","email":"flagxor@gmail.com"},"maintainers":[{"name":"flagxor","email":"flagxor@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/wwwbasic_1.0.2_1771286917043_0.8345431356926651"},"_hasShrinkwrap":false}},"time":{"created":"2018-09-20T09:10:25.528Z","modified":"2026-02-17T00:08:37.301Z","1.0.0":"2018-09-20T09:10:25.718Z","1.0.1":"2026-02-15T07:37:47.615Z","1.0.2":"2026-02-17T00:08:37.188Z"},"bugs":{"url":"https://github.com/google/wwwbasic/issues"},"author":{"name":"Brad Nelson","email":"flagxor@gmail.com","url":"http://flagxor.com/"},"license":"Apache-2.0","homepage":"https://github.com/google/wwwbasic#readme","keywords":["BASIC"],"repository":{"type":"git","url":"git+https://github.com/google/wwwbasic.git"},"description":"An implementation of BASIC designed to be easy to run on the Web","maintainers":[{"name":"flagxor","email":"flagxor@gmail.com"}],"readme":"[![NPM Package](https://img.shields.io/npm/v/wwwbasic.svg)](https://www.npmjs.com/package/wwwbasic)\n\n# wwwBASIC\n\nwwwBASIC is an implementation of BASIC (Beginner's All-purpose Symbolic\nInstruction Code) designed to be easy to run on the Web.\n\n## How to use wwwBASIC\n\nYou can include wwwBASIC directly in Web pages:\n\n```html\n<!DOCTYPE html>\n<html>\n  <head>\n    <script src=\"https://google.github.io/wwwbasic/wwwbasic.js\"></script>\n    <script type=\"text/basic\">\n      PRINT \"Hello World!\"\n      FOR i = 1 to 10\n        PRINT \"Counting \"; i\n      NEXT i\n    </script>\n  </head>\n</html>\n```\n\nYou can also import wwwBASIC as a Node.js module.\n\nEither install it via [npm](https://www.npmjs.com/): `npm install -S wwwbasic`\n\nor clone the repository: `git clone https://github.com/google/wwwbasic.git`\n\nThen run your code:\n```js\nvar basic = require('wwwbasic'); // from NPM\n// var basic = require('./wwwbasic.js'); // from within the cloned repository directory\n\n// An ESM import is also available from wwwbasic.mjs\n// import basic from \"wwwbasic.mjs\";\n\nbasic.Basic(\n`\nPRINT \"Hello World!\"\nFOR i = 1 to 10\n  PRINT \"Counting \"; i\nNEXT i\n`);\n```\n\n## Features\n\nIt supports a range of features including:\n   * Graphics: 24-bit color, PSET, LINE, CIRCLE.\n   * Input: INKEY$, GETMOUSE.\n   * Source is parsed and compiled to JavaScript at load time.\n\n## Examples\n\n* [Circles](https://google.github.io/wwwbasic/examples/circles.html)\n  ([source](examples/circles.html)) - Some circles...\n* [DONKEY.BAS](https://google.github.io/wwwbasic/examples/donkey.html)\n  ([source](examples/donkey.html)) -\n  The classic \"game\", apparently\n  [co-authored by Bill Gates himself](https://blog.codinghorror.com/bill-gates-and-donkey-bas/).\n* [GET & PUT](https://google.github.io/wwwbasic/examples/getput.html)\n  ([source](examples/getput.html)) - Test of GET/PUT.\n* [Hello World](https://google.github.io/wwwbasic/examples/hello_world.html)\n  ([source](examples/hello_world.html)) - Hello.\n* [Lines](https://google.github.io/wwwbasic/examples/lines.html)\n  ([source](examples/lines.html)) - Some lines...\n* [Polar Grapher](https://google.github.io/wwwbasic/examples/polargrapher.html)\n  ([source](examples/polargrapher.html)) - Draws a polar graph using trig functions.\n* [Primes](https://google.github.io/wwwbasic/examples/primes.html)\n  ([source](examples/primes.html)) - Primes <3000.\n* [Slides](https://google.github.io/wwwbasic/examples/slides.html)\n  ([source](examples/slides.html)) - Reveal.BAS :-)\n* [Editor](https://google.github.io/wwwbasic/examples/editor.html)\n  ([source](examples/editor.html)) - Live editor using\n  [Ace](https://ace.c9.io/).\n\n## Options\n\nWhile by default wwwBASIC processes script tags of type=\"text/basic\",\nthe interpreter can also be invoked with various options.\n\n```js\nbasic.Basic(codeText, {\n  debug: true  // or false,\n  bindings: {\n    // a dictionary of external bindings, see below.\n    name: myfunc,\n  },\n});\n```\n\nDefault bindings are available from `basic.ConsoleBindings()`.\nBindings for a canvas are available from `basic.GraphicsBindings(canvas)`.\n\nNOTE: **External bindings are currently consindered a semi-unstable feature,\nuse with caution.**\n\nA Bindings can be custom (see below), but a few are foundational:\n\n* PutCh(ch) - Print one character. PutCh(undefined) must flush.\n* Halt() - Print any final message at END.\n* TODO: Bindings for input!\n\nAdditionally, custom statements and procedures can be added with\nthe following naming convention:\n\n* `kind_name_arguments`\n* **kind** = statement / call\n* **name** = the name of the subroutine or statement in lowercase\n* **arguements** = argument spec see below\n\nThe argument spec uses one character per argument:\n\n* i - input / I - optional input\n* o - output / O - optional output\n* p - point (x, y) / P - optional point (passes 2 values)\n* s - string flag / S - optional string flag (e.g. BF for LINE)\n* d - dash (e.g. in words like LINE)\n* v - varptr (e.g. in words list GET / PUT, passes buffer, offset)\n\nEXAMPLE:\n\n```js\nvar bindings = GraphicsBindings(canvas);\nbindings.statement_foo_pIS = function(x, y, color, style) {\n  // x and y: are always available\n  // color: might be undefined\n  // style: might be undefined and is a literal string\n};\nbasic.Basic(\n`\nfoo (10, 20), 1, dashed\n`, { bindings: mybindings });\n```\n\n## Test Suite\n\nwwwBASIC has a \"work in progress\" test suite.\nIt can be run with: `./tests/run-tests.sh`.\n\n## But Why?\n\nThe immediate trigger for wwwBASIC's existence was\nEd Thelen's Nike Hercules\n[simulator](http://ed-thelen.org/NikeSimulation.html#SimBrowser).\nIt had been written in BASIC some time back,\nthen ported to some unknown version of FreeBasic.\nHowever, while he had screenshots and source code,\nit also included a Windows .EXE to a download,\nand the statement, \"guaranteed to be free of viruses\" :-/\n\nAs it was meant to capture how something historical worked,\nit seemed unfortunate that something of this sort\ncouldn't just be accessible directly on the web.\nVarious whole system emulators that run on the web are available,\nbut booting a whole system for a small program seemed like overkill.\n\nHence the first goal was to get\n[this](http://ed-thelen.org/nike-fromBradNelsonSept26.html) to run.\n\nFrom there, bringing up\n[DONKEY.BAS](https://google.github.io/wwwbasic/examples/donkey.html)\nseemed a nice logical milestone.\nBringing up GORILLA.BAS and NIBBLES.BAS are a current focus.\n\n## Source Code Headers\n\nEvery file containing source code must include copyright and license\ninformation. This includes any JS/CSS files that you might be serving out to\nbrowsers. (This is to help well-intentioned people avoid accidental copying that\ndoesn't comply with the license.)\n\nApache header:\n\n    Copyright 2018 Google LLC\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        https://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","readmeFilename":"README.md"}