File modules/editor/codemirror/mode/brainfuck/index.html

Last commit: Sun Dec 17 01:14:09 2017 +0100	Jan Dankert	Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.
1 <!doctype html> 2 3 <title>CodeMirror: Brainfuck mode</title> 4 <meta charset="utf-8"/> 5 <link rel=stylesheet href="../../doc/docs.css"> 6 7 <link rel="stylesheet" href="../../lib/codemirror.css"> 8 <script src="../../lib/codemirror.js"></script> 9 <script src="../../addon/edit/matchbrackets.js"></script> 10 <script src="./brainfuck.js"></script> 11 <style> 12 .CodeMirror { border: 2px inset #dee; } 13 </style> 14 <div id=nav> 15 <a href="http://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> 16 17 <ul> 18 <li><a href="../../index.html">Home</a> 19 <li><a href="../../doc/manual.html">Manual</a> 20 <li><a href="https://github.com/codemirror/codemirror">Code</a> 21 </ul> 22 <ul> 23 <li><a href="../index.html">Language modes</a> 24 <li><a class=active href="#"></a> 25 </ul> 26 </div> 27 28 <article> 29 <h2>Brainfuck mode</h2> 30 <form><textarea id="code" name="code"> 31 [ This program prints "Hello World!" and a newline to the screen, its 32 length is 106 active command characters [it is not the shortest.] 33 34 This loop is a "comment loop", it's a simple way of adding a comment 35 to a BF program such that you don't have to worry about any command 36 characters. Any ".", ",", "+", "-", "&lt;" and "&gt;" characters are simply 37 ignored, the "[" and "]" characters just have to be balanced. 38 ] 39 +++++ +++ Set Cell #0 to 8 40 [ 41 &gt;++++ Add 4 to Cell #1; this will always set Cell #1 to 4 42 [ as the cell will be cleared by the loop 43 &gt;++ Add 2 to Cell #2 44 &gt;+++ Add 3 to Cell #3 45 &gt;+++ Add 3 to Cell #4 46 &gt;+ Add 1 to Cell #5 47 &lt;&lt;&lt;&lt;- Decrement the loop counter in Cell #1 48 ] Loop till Cell #1 is zero; number of iterations is 4 49 &gt;+ Add 1 to Cell #2 50 &gt;+ Add 1 to Cell #3 51 &gt;- Subtract 1 from Cell #4 52 &gt;&gt;+ Add 1 to Cell #6 53 [&lt;] Move back to the first zero cell you find; this will 54 be Cell #1 which was cleared by the previous loop 55 &lt;- Decrement the loop Counter in Cell #0 56 ] Loop till Cell #0 is zero; number of iterations is 8 57 58 The result of this is: 59 Cell No : 0 1 2 3 4 5 6 60 Contents: 0 0 72 104 88 32 8 61 Pointer : ^ 62 63 &gt;&gt;. Cell #2 has value 72 which is 'H' 64 &gt;---. Subtract 3 from Cell #3 to get 101 which is 'e' 65 +++++++..+++. Likewise for 'llo' from Cell #3 66 &gt;&gt;. Cell #5 is 32 for the space 67 &lt;-. Subtract 1 from Cell #4 for 87 to give a 'W' 68 &lt;. Cell #3 was set to 'o' from the end of 'Hello' 69 +++.------.--------. Cell #3 for 'rl' and 'd' 70 &gt;&gt;+. Add 1 to Cell #5 gives us an exclamation point 71 &gt;++. And finally a newline from Cell #6 72 </textarea></form> 73 74 <script> 75 var editor = CodeMirror.fromTextArea(document.getElementById("code"), { 76 lineNumbers: true, 77 matchBrackets: true, 78 mode: "text/x-brainfuck" 79 }); 80 </script> 81 82 <p>A mode for Brainfuck</p> 83 84 <p><strong>MIME types defined:</strong> <code>text/x-brainfuck</code></p> 85 </article>
Download modules/editor/codemirror/mode/brainfuck/index.html
History Sun, 17 Dec 2017 01:14:09 +0100 Jan Dankert Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.