| 1 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|---|
| 2 |
<html> |
|---|
| 3 |
<head> |
|---|
| 4 |
<title>Interpreter - JavaScript Interactive Interpreter</title> |
|---|
| 5 |
<link href="interpreter.css" rel="stylesheet" type="text/css" /> |
|---|
| 6 |
<script type="text/javascript" src="../../MochiKit/MochiKit.js"></script> |
|---|
| 7 |
<script type="text/javascript" src="interpreter.js"></script> |
|---|
| 8 |
</head> |
|---|
| 9 |
<body> |
|---|
| 10 |
<h1> |
|---|
| 11 |
Interpreter - JavaScript Interactive Interpreter |
|---|
| 12 |
</h1> |
|---|
| 13 |
<div> |
|---|
| 14 |
<p> |
|---|
| 15 |
This demo is a JavaScript interpreter. Type some code into |
|---|
| 16 |
the text input and press enter to see the results. It uses |
|---|
| 17 |
<a href="http://mochikit.com">MochiKit</a>'s |
|---|
| 18 |
<a href="../../doc/html/MochiKit/DOM.html">MochiKit.DOM</a> |
|---|
| 19 |
to manipulate the display. It also supports waiting for |
|---|
| 20 |
<a href="../../doc/html/MochiKit/Async.html">MochiKit.Async</a> |
|---|
| 21 |
Deferreds via <tt>blockOn(aDeferred)</tt>. |
|---|
| 22 |
</p> |
|---|
| 23 |
</div> |
|---|
| 24 |
|
|---|
| 25 |
<div> |
|---|
| 26 |
View Source: [ |
|---|
| 27 |
<a href="index.html" class="view-source">index.html</a> | |
|---|
| 28 |
<a href="interpreter.js" class="view-source">interpreter.js</a> |
|---|
| 29 |
] |
|---|
| 30 |
</div> |
|---|
| 31 |
<form id="interpreter_form"> |
|---|
| 32 |
<div id="interpreter_area"> |
|---|
| 33 |
<div id="interpreter_output"></div> |
|---|
| 34 |
</div> |
|---|
| 35 |
<input id="interpreter_text" name="input_text" type="text" class="textbox" size="100" /> |
|---|
| 36 |
</form> |
|---|
| 37 |
<div> |
|---|
| 38 |
Notes: |
|---|
| 39 |
<ul> |
|---|
| 40 |
<li> |
|---|
| 41 |
To continue code on the next line, end it with |
|---|
| 42 |
<tt>//</tt> |
|---|
| 43 |
</li> |
|---|
| 44 |
<li> |
|---|
| 45 |
<tt>function name() {}</tt> syntax might not end up in |
|---|
| 46 |
window scope, so use <tt>name = function () {}</tt> |
|---|
| 47 |
syntax instead |
|---|
| 48 |
</li> |
|---|
| 49 |
<li> |
|---|
| 50 |
If you want to stuff something into the output window |
|---|
| 51 |
other than the <tt>repr(...)</tt> of the expression |
|---|
| 52 |
result, use the <tt>writeln(...)</tt> function. |
|---|
| 53 |
It accepts anything that MochiKit.DOM does, so you can |
|---|
| 54 |
even put styled stuff in there! |
|---|
| 55 |
</li> |
|---|
| 56 |
<li> |
|---|
| 57 |
Use <tt>clear()</tt> to clear the interpreter window. |
|---|
| 58 |
</li> |
|---|
| 59 |
<li> |
|---|
| 60 |
You can use <tt>blockOn(aDeferred)</tt> to wait on a |
|---|
| 61 |
Deferred. This expression must be used by itself, so |
|---|
| 62 |
the value must be obtained from <tt>_</tt> or |
|---|
| 63 |
<tt>last_exc</tt>. Typing any expression will |
|---|
| 64 |
cancel the Deferred. |
|---|
| 65 |
</li> |
|---|
| 66 |
<li> |
|---|
| 67 |
Up and down arrow keys work as a rudimentary history |
|---|
| 68 |
</li> |
|---|
| 69 |
<li> |
|---|
| 70 |
<tt>_</tt> is the value of the last expression |
|---|
| 71 |
that was not <tt>undefined</tt>, <tt>last_exc</tt> is |
|---|
| 72 |
the value of the last unhandled exception. |
|---|
| 73 |
</li> |
|---|
| 74 |
</ul> |
|---|
| 75 |
</div> |
|---|
| 76 |
</body> |
|---|
| 77 |
</html> |
|---|