You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Create .node-version file
* Fix `gl` build error via dependency resolution
Also bumps the version of `node-gyp` transitive dependency to address a
security vulnerability.
* Bump `gpu.js`, `gl` dependencies in ./sicp_publish
* Update CI workflows
Bumps dependency versions, as well as remove manual caching.
* Fix workflow errors due to missing libraries
* Bump NodeJS to v20.11.0
* Update README
* Update Node version
* Remove duplicate header
* Change H1s to H2s for better hierarchy
* Reformat README
* Remove soft breaks
* Add syntax highlighting for commands
* Fix license line break
Open-source implementations of the programming language _Source_. Source is a
4
-
series of small subsets of JavaScript, designed for teaching university-level
5
-
programming courses for computer science majors, following Structure and
6
-
Interpretation of Computer Programs, JavaScript Adaptation
7
-
(<https://sourceacademy.org/sicpjs/>).
3
+
Open-source implementations of the programming language _Source_. Source is a series of small subsets of JavaScript, designed for teaching university-level programming courses for computer science majors, following Structure and Interpretation of Computer Programs, JavaScript Adaptation (<https://sourceacademy.org/sicpjs/>).
8
4
9
-
# Table of Contents
5
+
##Table of Contents
10
6
11
-
-[Requirements](#requirements)
7
+
-[Prerequisites](#prerequisites)
12
8
-[Usage](#usage)
13
9
-[Documentation](#documentation)
14
-
-[Requirements](#requirements-1)
10
+
-[Requirements](#requirements)
15
11
-[Testing](#testing)
16
12
-[Error messages](#error-messages)
17
13
-[Using your js-slang in Source Academy](#using-your-js-slang-in-source-academy)
@@ -20,18 +16,16 @@ Interpretation of Computer Programs, JavaScript Adaptation
20
16
-[Talks and Presentations](#talks-and-presentations)
21
17
-[License](#license)
22
18
23
-
#Requirements
19
+
## Prerequisites
24
20
25
-
- node: known working version: v16.14.0
21
+
- NodeJS v20
22
+
- Python: On MacBook Pro with chip Apple M1 Pro, use python 3.10.12. Here is [the correct way to set Python 3 as default on a Mac](https://opensource.com/article/19/5/python-3-default-mac).
26
23
27
-
- python: On MacBook Pro with chip Apple M1 Pro, use python 3.10.12. Here is
28
-
[the correct way to set Python 3 as default on a Mac](https://opensource.com/article/19/5/python-3-default-mac).
**Note:** The documentation may not build on Windows, depending on your bash setup, [see above](https://github.com/source-academy/js-slang#requirements).
131
122
132
-
Documentation on the Source libraries are generated from inline documentation in
133
-
the library sources, a copy of which are kept in `docs/lib/*.js`. The command
134
-
`yarn jsdoc` generates the documentation and places it in the folder
135
-
`docs/source`. You can test the documentation using a local server:
123
+
Documentation on the Source libraries are generated from inline documentation in the library sources, a copy of which are kept in `docs/lib/*.js`. The command `yarn jsdoc` generates the documentation and places it in the folder `docs/source`. You can test the documentation using a local server:
136
124
137
-
```{.}
125
+
```bash
138
126
$ cd docs/source; python -m http.server 8000
139
127
```
140
128
141
-
Documentation of libraries is displayed in autocomplete in the frontend. This
142
-
documentation is generated by `./scripts/updateAutocompleteDocs.py` and placed
143
-
in `src/editors/ace/docTooltip/*.json` files. This script is run by
144
-
`yarn build`prior to`tsc`. To add a Source variant to the frontend autocomplete,
145
-
edit `src/editors/ace/docTooltip/index.ts`
146
-
and`./scripts/updateAutocompleteDocs.py`.
129
+
Documentation of libraries is displayed in autocomplete in the frontend. This documentation is generated by `./scripts/updateAutocompleteDocs.py` and placed in `src/editors/ace/docTooltip/*.json` files. This script is run by `yarn build`prior to`tsc`. To add a Source variant to the frontend autocomplete, edit `src/editors/ace/docTooltip/index.ts` and`./scripts/updateAutocompleteDocs.py`.
147
130
148
-
# Testing
131
+
##Testing
149
132
150
-
`js-slang` comes with an extensive test suite. To run the tests after you made
151
-
your modifications, run `yarn test`. Regression tests are run automatically when
152
-
you want to push changes to this repository. The regression tests are generated
153
-
using `jest` and stored as snapshots in `src/\_\_tests\_\_`. After modifying
154
-
`js-slang`, carefully inspect any failing regression tests reported in red in
155
-
the command line. If you are convinced that the regression tests and not your
156
-
changes are at fault, you can update the regression tests as follows:
133
+
`js-slang` comes with an extensive test suite. To run the tests after you made your modifications, run `yarn test`. Regression tests are run automatically when you want to push changes to this repository. The regression tests are generated using `jest` and stored as snapshots in `src/\_\_tests\_\_`. After modifying `js-slang`, carefully inspect any failing regression tests reported in red in the command line. If you are convinced that the regression tests and not your changes are at fault, you can update the regression tests as follows:
157
134
158
-
```{.}
135
+
```bash
159
136
$ yarn test -- --updateSnapshot
160
137
```
161
138
162
-
# Error messages
139
+
##Error messages
163
140
164
-
To enable verbose messages, have the statement `"enable verbose";` as the first
165
-
line of your program. This also causes the program to be run by the interpreter.
141
+
To enable verbose messages, have the statement `"enable verbose";` as the first line of your program. This also causes the program to be run by the interpreter.
166
142
167
-
There are two main kinds of error messages: those that occur at runtime and
168
-
those that occur at parse time. The first can be found in
169
-
`interpreter-errors.ts`, while the second can be found in `rules/`.
143
+
There are two main kinds of error messages: those that occur at runtime and those that occur at parse time. The first can be found in `interpreter-errors.ts`, while the second can be found in `rules/`.
170
144
171
-
Each error subclass will have `explain()` and `elaborate()`. Displaying the
172
-
error will always cause the first to be called; the second is only called when
173
-
verbose mode is enabled. As such, `explain()` should be made to return a string
174
-
containing the most basic information about what the error entails. Any
175
-
additional details about the error message, including specifics and correction
176
-
guides, should be left to `elaborate()`.
145
+
Each error subclass will have `explain()` and `elaborate()`. Displaying the error will always cause the first to be called; the second is only called when verbose mode is enabled. As such, `explain()` should be made to return a string containing the most basic information about what the error entails. Any additional details about the error message, including specifics and correction guides, should be left to `elaborate()`.
177
146
178
-
Please remember to write test cases to reflect your added functionalities. The
179
-
god of this repository is self-professed to be very particular about test cases.
147
+
Please remember to write test cases to reflect your added functionalities. The god of this repository is self-professed to be very particular about test cases.
180
148
181
-
# Using your js-slang in Source Academy
149
+
##Using your js-slang in Source Academy
182
150
183
-
js-slang is used by the [Source Academy](https://sourceacademy.org), the
184
-
immersive online experiential environment for learning programming. For this,
185
-
js-slang is
186
-
[deployed as an NPM package](https://www.npmjs.com/package/js-slang). The
187
-
frontend of the Source Academy then includes the js-slang package in its
188
-
deployment bundle.
151
+
js-slang is used by the [Source Academy](https://sourceacademy.org), the immersive online experiential environment for learning programming. For this, js-slang is [deployed as an NPM package](https://www.npmjs.com/package/js-slang). The frontend of the Source Academy then includes the js-slang package in its deployment bundle.
189
152
190
-
# Using your js-slang in your local Source Academy
153
+
##Using your js-slang in your local Source Academy
191
154
192
-
A common issue when developing modifications to js-slang is how to test it using
193
-
your own local frontend. Assume that you have built your own frontend locally,
194
-
here is how you can make it use your own js-slang, instead of the one that the
195
-
Source Academy team has deployed to npm.
155
+
A common issue when developing modifications to js-slang is how to test it using your own local frontend. Assume that you have built your own frontend locally, here is how you can make it use your own js-slang, instead of the one that the Source Academy team has deployed to npm.
196
156
197
157
First, build and link your local js-slang:
198
158
199
-
```{.}
159
+
```bash
200
160
$ cd js-slang
201
161
$ yarn build
202
162
$ yarn link
203
163
```
204
164
205
165
Then, from your local copy of frontend:
206
166
207
-
```{.}
167
+
```bash
208
168
$ cd frontend
209
169
$ yarn link "js-slang"
210
170
```
211
171
212
172
Then start the frontend and the new js-slang will be used.
213
173
214
-
# Building and publishing SICP package
174
+
##Building and publishing SICP package
215
175
216
176
To build SICP package
217
177
218
-
```{.}
178
+
```bash
219
179
$ cd js-slang
220
180
$ yarn
221
181
$ yarn build_sicp_package
222
182
```
223
183
224
184
To publish SICP package, update version number in `sicp_publish/package.json`
225
185
226
-
```{.}
186
+
```bash
227
187
$ cd js-slang/sicp_publish
228
188
$ npm publish
229
189
```
230
190
231
-
# Talks and Presentations
191
+
##Talks and Presentations
232
192
233
-
-**How `js-slang` works under the hood**[17th Jan 2023][The
-**How `js-slang` works under the hood** (17th Jan 2023 – The Gathering) ([slides](https://docs.google.com/presentation/d/1GFR39iznBZxWv948zUsmcbCSSDasm4xYs3Jc5GF7A3I/edit?usp=sharing))
0 commit comments