wwwbasic 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -18
- package/package.json +4 -3
- package/wwwbasic.js +2789 -2217
package/README.md
CHANGED
|
@@ -1,29 +1,40 @@
|
|
|
1
|
-
[](https://www.npmjs.com/package/wwwbasic)
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# wwwBASIC
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
wwwBASIC is an implementation of BASIC (Beginner's All-purpose Symbolic
|
|
6
6
|
Instruction Code) designed to be easy to run on the Web.
|
|
7
7
|
|
|
8
|
-
## How to use
|
|
8
|
+
## How to use wwwBASIC
|
|
9
9
|
|
|
10
|
-
You can include
|
|
10
|
+
You can include wwwBASIC directly in Web pages:
|
|
11
11
|
|
|
12
|
-
```
|
|
12
|
+
```html
|
|
13
13
|
<!DOCTYPE html>
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
<html>
|
|
15
|
+
<head>
|
|
16
|
+
<script src="https://google.github.io/wwwbasic/wwwbasic.js"></script>
|
|
17
|
+
<script type="text/basic">
|
|
18
|
+
PRINT "Hello World!"
|
|
19
|
+
FOR i = 1 to 10
|
|
20
|
+
PRINT "Counting "; i
|
|
21
|
+
NEXT i
|
|
22
|
+
</script>
|
|
23
|
+
</head>
|
|
24
|
+
</html>
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
You can also import
|
|
27
|
+
You can also import wwwBASIC as a Node.js module.
|
|
28
|
+
|
|
29
|
+
Either install it via [npm](https://www.npmjs.com/): `npm install -S wwwbasic`
|
|
30
|
+
|
|
31
|
+
or clone the repository: `git clone https://github.com/google/wwwbasic.git`
|
|
32
|
+
|
|
33
|
+
Then run your code:
|
|
34
|
+
```js
|
|
35
|
+
var basic = require('wwwbasic'); // from NPM
|
|
36
|
+
// var basic = require('./wwwbasic.js'); // from within the cloned repository directory
|
|
24
37
|
|
|
25
|
-
```
|
|
26
|
-
var basic = require('./wwwbasic.js');
|
|
27
38
|
basic.Basic(
|
|
28
39
|
`
|
|
29
40
|
PRINT "Hello World!"
|
|
@@ -42,8 +53,8 @@ It supports a range of features including:
|
|
|
42
53
|
|
|
43
54
|
## Test Suite
|
|
44
55
|
|
|
45
|
-
|
|
46
|
-
It can be run with: `./run-tests.sh`.
|
|
56
|
+
wwwBASIC has a "work in progress" test suite.
|
|
57
|
+
It can be run with: `./tests/run-tests.sh`.
|
|
47
58
|
|
|
48
59
|
## Examples
|
|
49
60
|
|
|
@@ -59,6 +70,8 @@ It can be run with: `./run-tests.sh`.
|
|
|
59
70
|
([source](examples/hello_world.html)) - Hello.
|
|
60
71
|
* [Lines](https://google.github.io/wwwbasic/examples/lines.html)
|
|
61
72
|
([source](examples/lines.html)) - Some lines...
|
|
73
|
+
* [Polar Grapher](https://google.github.io/wwwbasic/examples/polargrapher.html)
|
|
74
|
+
([source](examples/polargrapher.html)) - Draws a polar graph using trig functions.
|
|
62
75
|
* [Primes](https://google.github.io/wwwbasic/examples/primes.html)
|
|
63
76
|
([source](examples/primes.html)) - Primes <3000.
|
|
64
77
|
* [Slides](https://google.github.io/wwwbasic/examples/slides.html)
|
|
@@ -67,6 +80,31 @@ It can be run with: `./run-tests.sh`.
|
|
|
67
80
|
([source](examples/editor.html)) - Live editor using
|
|
68
81
|
[Ace](https://ace.c9.io/).
|
|
69
82
|
|
|
83
|
+
## But Why?
|
|
84
|
+
|
|
85
|
+
The immediate trigger for wwwBASIC's existence was
|
|
86
|
+
Ed Thelen's Nike Hercules
|
|
87
|
+
[simulator](http://ed-thelen.org/NikeSimulation.html#SimBrowser).
|
|
88
|
+
It had been written in BASIC some time back,
|
|
89
|
+
then ported to some unknown version of FreeBasic.
|
|
90
|
+
However, while he had screenshots and source code,
|
|
91
|
+
it also included a Windows .EXE to a download,
|
|
92
|
+
and the statement, "guaranteed to be free of viruses" :-/
|
|
93
|
+
|
|
94
|
+
As it was meant to capture how something historical worked,
|
|
95
|
+
it seemed unfortunate that something of this sort
|
|
96
|
+
couldn't just be accessible directly on the web.
|
|
97
|
+
Various whole system emulators that run on the web are available,
|
|
98
|
+
but booting a whole system for a small program seemed like overkill.
|
|
99
|
+
|
|
100
|
+
Hence the first goal was to get
|
|
101
|
+
[this](http://ed-thelen.org/nike-fromBradNelsonSept26.html) to run.
|
|
102
|
+
|
|
103
|
+
From there, bringing up
|
|
104
|
+
[DONKEY.BAS](https://google.github.io/wwwbasic/examples/donkey.html)
|
|
105
|
+
seemed a nice logical milestone.
|
|
106
|
+
Bringing up GORILLA.BAS and NIBBLES.BAS are a current focus.
|
|
107
|
+
|
|
70
108
|
## Source Code Headers
|
|
71
109
|
|
|
72
110
|
Every file containing source code must include copyright and license
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wwwbasic",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "An implementation of BASIC designed to be easy to run on the Web",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"BASIC"
|
|
@@ -18,13 +18,14 @@
|
|
|
18
18
|
"main": "wwwbasic.js",
|
|
19
19
|
"directories": {
|
|
20
20
|
"example": "examples",
|
|
21
|
-
"test": "test"
|
|
21
|
+
"test": "test",
|
|
22
|
+
"tools": "tools"
|
|
22
23
|
},
|
|
23
24
|
"repository": {
|
|
24
25
|
"type": "git",
|
|
25
26
|
"url": "git+https://github.com/google/wwwbasic.git"
|
|
26
27
|
},
|
|
27
28
|
"scripts": {
|
|
28
|
-
"test": "./run-tests.sh"
|
|
29
|
+
"test": "./test/run-tests.sh"
|
|
29
30
|
}
|
|
30
31
|
}
|