web/contents/get.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
<article>
<h2>Get Started</h2>
<h3>Building from Source</h3>
<p>Building hex from source is easy: just run <code>make</code> after <a
href="https://git.sr.ht/~h3rald/hex">cloning
the repo</a> to build the hex executable for
your platform.</p>
<p>This assumes that you have a C compiler like GCC and the make command installed. On Windows, you may want to
look
into <a href="https://www.msys2.org" target="_blank">MSYS2</a>.</p>
<p> Note that <code>make</code> will first generate a single, amalgamated <code>hex.c</code> file containing all
the concatenated sources in the right order. You can use this file for easily embedding hex in your own
C projects.</p>
<p>You can also:</p>
<ul>
<li>Run <code>make test</code> to run the test suite.</li>
<li>Run <code>make ape</code> to generate an αcτµαlly pδrταblε εxεcµταblε (requires <a
href="https://github.com/jart/cosmopolitan" target="_blank">Cosmopolitan</a>). </li>
<li>Run <code>make wasm</code> to generate a <code>hex.js</code> and a <code>hex.wasm</code>
(WebAssembly) file
(requires the <a href="https://github.com/emscripten-core/emsdk" target="_blank">Emscripten
SDK</a>). </li>
</ul>
<blockquote>
<div>A note on the WASM build</div>
<p>The main purpose of the WASM build is to power the <a href="/play">playground</a>. If you try to run
it with
NodeJS, the REPL will also <em>somewhat</em> work, except that file support and executing
processes doesn't
seem to behave, at the moment, and neither does `printf` unless you add a new line so... use at
your own
risk, or please use one of the other builds.</p>
</blockquote>
<h3>Command Line Options</h3>
<p>Running <code>hex -h</code> will print the following list of all the available command line options for the
hex
executable:</p>
<pre>
_*_ _
/ \hex\*
*\_/_/_/ v{{release}} - (c) {{year}} Fabio Cevasco
*
USAGE
hex [options] [file]
ARGUMENTS
file A .hex or .hbx file to interpret
OPTIONS
-b, --bytecode Generate a .hbx bytecode file.
-d, --debug Enable debug mode.
-h, --help Display this help message.
-l, --load Load a .hex or .hbx file before interpreting
the main file or starting the REPL
(can be specified multiple times).
-m, --manual Display the manual.
-v, --version Display hex version.
</pre>
<p>If you do not specify any option or argument, a simple <abbr title="Read-Eval-Print-Loop">REPL</abbr> will be
started.</p>
<p>Alternatively, you can also pipe input from standard input:
<p>
<pre><code>echo "$2 $2 + puts" | hex</code></pre>
<h3>Syntax Highlighting</h3>
<p>If you use the Vim editor, you can use <a href="https://github.com/h3rald/hex/blob/master/hex.vim"
target="_blank">hex.vim</a> to highlight hex files.</p>
<p>If you use Visual Studio Code, you can use the <a
href="https://marketplace.visualstudio.com/items?itemName=h3rald.vscode-hex-lang">hex</a>
extension to
highlight hex files. </p>
</article>
|