mwh/minigrace — pull request #6 by DanielGibbsNZ (2013-03-25 02:35:53+00:00)
Title: Decouple js compiler from existing web front-end.

What I've done (in summary):

- Modified the makefile to put all the javascript generated in to js/minigrace.js. This makes it much easier to include on a webpage. This could further be minified, although this would make debugging hard.
- Created a MiniGrace class and instantiated an instance of that class called "minigrace". This is an easy way for the webpage using the compiler to set it up properly.
- When a webpage includes minigrace, it needs to define minigrace.stdout_print, minigrace.stderr_print, and minigrace.stdin_read functions.
- It can also read the generated code from minigrace.generated_output.
- Mode, module name, and visibility can be changed by editing the values of minigrace.mode, minigrace.modname, and minigrace.vis respectively.

The existing frontend is now decoupled from the compiler and interacts with the compiler as described here. All tests pass, and I can not find anything wrong.

Now that this is done, it is easy to integrate into another website. For example, my "Learn Grace" prototype: http://homepages.ecs.vuw.ac.nz/~gibbsdani/learngrace/

I'm sure that a lot of what I've done isn't quite right, or is not the best way to do things, so please let me know what I can do to improve/fix it.