I wrote a single web page that allows scripting, in Javascript, an interpreter that can then be scripted with.
I wanted to play with domain specific languages in a graphical environment I could understand. The Javascript engine in the browser turned out perfect for this. In addition, the browser itself allows saving a page, including text entered into textareas, allowing for source code persistence.
The default workspace has 3 text boxes, the first column is the source editor, the second is an output-only box, and the last one on the right is the source code for the source editor itself.
I was getting tired of fixing the page's code and refreshing the page to test it, so I made the source editable from within the page. Any errors I come across can now be patched without every refreshing the page. Though it is still useful for clearing the Javascript environment.
The only hidden Javascript in the page is the "load_core" function, assigned to on_click for the button "Load Core". This should be loaded when the page is, but if not then the button can be pressed to set everything up.
A sample pair of scripts have been provided that will replace "eval" with a function that sends future scripts to the output box.
How it works
The source editor is viewed as a stack of text boxes, each of which is passed to the present "eval" function one at a time. This allows boxes to alter how future boxes will execute by assigning a function to "eval". Perfect for domain specific language testing.
To add boxes, a "Add Source" button will be available below the source editor. Clicking it will append a new box to the page.
To execute the scripts, click the "Evaluate" button at the top of the page.
The core editor allows changing the script for the source editor and loading changes into the page. This has the added effect that you can easily learn how the entire page works by browsing the core.
The output box is useful when you don't want to have the browser console open, and is an example for adding graphical elements to a language's execution. It has the functions "output.log" and "output.clear". "log" appends a string to it; "clear" clears it.
If you've ever entered text into a PDF file using the browser and saved it with the text added, the same process is in effect here. Ctrl+S will download the entire page to a single html file, including any scripts you added and changes to the core.
The "Source Editor" and "Core Editor" buttons at the top of the page will show/hide the source and core editors, respectively. Useful if you don't want to see the core until you need to patch it.