_*_ _
 / \

hex

\* programming language *\_/_/_/ *

Get Started

The following pre-built binaries are available for download:

A note on the WASM build

The main purpose of the WASM build is to power the playground. If you try to run it with NodeJS, the REPL will also somewhat 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.

Building from Source

Building from source is easy: just run make after cloning the repo to build the hex executable for your platform.

This assumes that you have a C compiler like GCC and the make command installed. On Windows, you may want to look into MSYS2.

Note that make will first generate a single, amalgamated hex.c file containing all the concatenated sources in the right order. You can use this file for easily embedding hex in your own C projects.

You can also:

Command Line Options

Running hex -h will print the following list of all the available command line options for the hex executable:

  _*_ _
 / \hex\* 
*\_/_/_/  v0.2.0 - (c) 2024 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.
 -m, --manual    Display the manual.
 -v, --version   Display hex version.
    

If you do not specify any option or argument, a simple REPL will be started.

Alternatively, you can also pipe input from standard input:

echo "0x2 0x2 + puts" | hex

Syntax Highlighting

If you use the Vim editor, you can use hex.vim to highlight hex files.

If you use Visual Studio Code, you can use the hex extension to highlight hex files.