| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/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" autocomplete="off"> |
| 32 | <div id="interpreter_area"> |
| 33 | <div id="interpreter_output"></div> |
| 34 | </div> |
| 35 | <div id="oneline"> |
| 36 | <input id="interpreter_text" name="input_text" type="text" class="textbox" size="100" /> |
| 37 | </div> |
| 38 | <div id="multiline"> |
| 39 | <textarea id="interpreter_textarea" name="input_textarea" type="text" class="textbox" cols="97" rows="10"></textarea> |
| 40 | <br /> |
| 41 | </div> |
| 42 | </form> |
| 43 | <div> |
| 44 | Notes: |
| 45 | <ul> |
| 46 | <li> |
| 47 | To show the signature of a MochiKit function and link |
| 48 | to its documentation, type help(fn) on any MochiKit |
| 49 | function. |
| 50 | </li> |
| 51 | <li> |
| 52 | To write multi-line code snippets, use the lower text area |
| 53 | and press ctrl-enter or cmd-enter to submit. |
| 54 | </li> |
| 55 | <li> |
| 56 | <tt>function name() {}</tt> syntax might not end up in |
| 57 | window scope, so use <tt>name = function () {}</tt> |
| 58 | syntax instead |
| 59 | </li> |
| 60 | <li> |
| 61 | If you want to stuff something into the output window |
| 62 | other than the <tt>repr(...)</tt> of the expression |
| 63 | result, use the <tt>writeln(...)</tt> function. |
| 64 | It accepts anything that MochiKit.DOM does, so you can |
| 65 | even put styled stuff in there! |
| 66 | </li> |
| 67 | <li> |
| 68 | Use <tt>clear()</tt> to clear the interpreter window. |
| 69 | </li> |
| 70 | <li> |
| 71 | You can use <tt>blockOn(aDeferred)</tt> to wait on a |
| 72 | Deferred. This expression must be used by itself, so |
| 73 | the value must be obtained from <tt>_</tt> or |
| 74 | <tt>last_exc</tt>. Typing any expression will |
| 75 | cancel the Deferred. |
| 76 | </li> |
| 77 | <li> |
| 78 | Up and down arrow keys work as a rudimentary history |
| 79 | </li> |
| 80 | <li> |
| 81 | <tt>_</tt> is the value of the last expression |
| 82 | that was not <tt>undefined</tt>, <tt>last_exc</tt> is |
| 83 | the value of the last unhandled exception. |
| 84 | </li> |
| 85 | </ul> |
| 86 | </div> |
| 87 | </body> |
| 88 | </html> |