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
* Add specified function definitions
Misc functions are to be imported after this
* Import type checking and error methods
Only some are used, but all of them are imported to keep this file up to
date with all the functions that were present before
* Remove duplicate error function
* Add metaCircularParser to Context
This Parser will be preserved for the lifetime of the Context, and this
ensures that it is reset together with the context as well.
* Add parse function
* Fix no typing error for misc
* Rename JSON.stringify -> stringify
* Remove unused Parser import
From rebasing away jison commits
* Add base parser file
* Format parser file
* Use .js for parser file
* Import and use parser for parse function
* Add parser jison source
* Add metacircular interpreter source
* Add doc to refer to source
* Fix tests not compiling
There was a problem with transpiling the files when testing, because of
the .js files used. I first added a transformer for the .js files (that
didnt have one at first, throwing an error at the `export` line in
parser.js). Then, I added the presets required, which were displayed as
missing presets when trying to test
* Update build to a script
This script will run the typescript build, and then copy over the
required .js file over. Note that to add more .js files, the build
script will need to be modified.
* Use && for failing tsc
* testing dev env
* Add .js files to interpreter folder
Oh my
* testing of martins dev setup for meta
* another try
* another try: getting really ugly
* getting uglier
* getting ready for prime time
* forgot removing tag
* trying to get => to work
* another attempt to fix arrow
* minor mods
####_vastly more up-to-date instructions, in nice Markdown format._
3
+
4
+
This project comprises 4 main components:
5
+
6
+
1. The parser, written in Jison
7
+
2. The interpreter, written in legal JediScript
8
+
3. The scratch project templates, which are a combination of JediScript, JavaScript, and Markup-JS (a templating engine)
9
+
4. The project generator (`generate.js`)
10
+
11
+
These all work together to form the functional evaluator.
12
+
13
+
## Setting up the environment
14
+
1. This project depends on node.js. Install [node.js](http://nodejs.org) for your platform.
15
+
2. Using the shell for your platform, run `envsetup.{sh|bat}`. This will obtain the necessary installation dependencies and generate the development versions of the templates.
16
+
- Note that your Jison install will be patched to throw SyntaxError exceptions when parse errors occur. This may affect your other Jison dependents, if any.
17
+
2 (alternative) . Just run `npm install` and all the dependencies should be magically installed.
18
+
3. If you have made changes to the templates, generate new development libraries by running `generate.js --environment`.
19
+
4.`scratch.html` in the root directory of the project has got the evaluator-in-evaluator code being part of `test3`. Use that to test the interpreter interpreting itself.
20
+
21
+
## Generating Student Scratch Projects
22
+
In addition to generating the development libraries, the templates can be used in concert with the generator to produce scratch projects which only contain valid JediScript elements for any given week. Generate these by running `generate.js --week N`.
23
+
24
+
If you are modifying the templates, note that:
25
+
26
+
- When modifying the Jison template source, Jison blocks within Markup-JS blocks (i.e. Jison declarations within the `{{if}}` or other blocks) must have `$$` escaped to `$$$`. This is because Markup-JS will remove one `$`, leaving invalid Jison declarations
27
+
- If new user-defined functions must be provided to the student, update `export.js`. `export.js` contains a list of key-value pairs, which will be registered in the interpreter so the student can access them from his script file.
28
+
- By default, the generated scratch project will have the parser screen the input from the student's script tags and evaluate it. The student's code can still be directly evaluated by the browser's JavaScript engine by passing `--native` (`--no-native` will equivalently enable interpreted mode. But that's the default)
29
+
- The generator will send all output through to Google's Closure compiler, both to shrink the codebase and also to optimise the code. Passing `--debug` while generating the package will suppress this, so that the generator (or the libraries) can be debugged.
30
+
31
+
## Unit Testing
32
+
I've coded unit tests for the interpreter. Open `test.html`, the test suite will run automatically. This uses the parser and other libraries generated by `generate.js --environment`, so be sure to run it before any testing.
0 commit comments