all repos — hex @ e2b565282ac9f39e99fb6d355bfcddce9756e99d

A tiny, minimalist, slightly-esoteric, concatenative programming lannguage.

Merge branch 'master' of git.sr.ht:~h3rald/hex
h3rald h3rald@h3rald.com
Thu, 25 Jun 2026 11:07:11 +0200
commit

e2b565282ac9f39e99fb6d355bfcddce9756e99d

parent

d43839957b33ad012da7cf9e25d4d67f03770a32

A .conver/history.txt

@@ -0,0 +1,1 @@

+2026-06-15: +4800 # Re-released using ConVer
A .conver/release.txt

@@ -0,0 +1,1 @@

+4800
D .github/workflows/ci.yml

@@ -1,70 +0,0 @@

-name: CI - -# Controls when the action will run. -on: - # Triggers the workflow on push or pull request events but only for the master branch - push: - branches: [ master ] - pull_request: - branches: [ master ] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "ci" - ci: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest - - macos-14 - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v2 - - - name: Build - run: make - - - name: Test - run: make test - - # Install cosmocc - - name: Install cosmocc - run: | - mkdir -p $HOME/cosmocc - cd $HOME/cosmocc - wget -q https://cosmo.zip/pub/cosmocc/cosmocc.zip - unzip -q cosmocc.zip - pwd - ls -l - if: matrix.os == 'ubuntu-latest' - - # Add cosmocc to PATH + see https://redbean.dev/#install - - name: Add cosmocc to PATH - run: | - echo $HOME/cosmocc/bin >> $GITHUB_PATH - sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf - sudo chmod +x /usr/bin/ape - sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" - sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" - if: matrix.os == 'ubuntu-latest' - - # Generate APE binary - - name: Generate APE binary - run: | - rm hex - make ape - if: matrix.os == 'ubuntu-latest' - - # Run tests with APE binary - - name: Test (APE) - run: | - make test - if: matrix.os == 'ubuntu-latest'
D .github/workflows/release.yml

@@ -1,140 +0,0 @@

-name: Release - -# Controls when the action will run. -on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - release: - name: "Build and upload artifacts" - runs-on: ${{ matrix.os }} - permissions: - contents: write - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest - - macos-14 - steps: - # Cancel other actions of the same type that might be already running - - name: "Cancel similar actions in progress" - uses: styfle/cancel-workflow-action@0.9.1 - with: - access_token: ${{ github.token }} - - # Detects OS and provide Nim-friendly OS identifiers - - name: Detect current OS - id: os - run: echo "os=${{matrix.os == 'ubuntu-latest' && 'linux' || matrix.os == 'macos-latest' && 'macos' || matrix.os == 'macos-14' && 'macos' || matrix.os == 'windows-latest' && 'windows'}}" >> $GITHUB_OUTPUT - - # Checks out the repository - - uses: actions/checkout@v2 - - # Install cosmocc - - name: Install cosmocc - run: | - mkdir -p $HOME/cosmocc - cd $HOME/cosmocc - wget -q https://cosmo.zip/pub/cosmocc/cosmocc.zip - unzip -q cosmocc.zip - pwd - ls -l - if: matrix.os == 'ubuntu-latest' - - # Setup emsdk - - name: Setup emsdk - uses: mymindstorm/setup-emsdk@v14 - if: matrix.os == 'ubuntu-latest' - - # Retrieve ID and Name of the current (draft) release - - name: "Get current release" - id: current-release - uses: InsonusK/get-latest-release@v1.0.1 - with: - myToken: ${{ github.token }} - exclude_types: "release" - view_top: 1 - - # Build (non-Windows) - - name: Build - run: make - if: matrix.os != 'windows-latest' - - # Build libs (non-Windows) - - name: Build - run: make utils.hbx - if: matrix.os != 'windows-latest' - - # Package the resulting Linux/macOS binary - - name: Create artifact (Linux, macOS) - run: zip hex_${{steps.current-release.outputs.tag_name}}_${{steps.os.outputs.os}}_x86_64.zip hex lib/utils.hbx - if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-14' - - # Package the resulting macOs latest binary - - name: Create artifact (Linux, macOS) - run: zip hex_${{steps.current-release.outputs.tag_name}}_${{steps.os.outputs.os}}_arm64.zip hex lib/utils.hbx - if: matrix.os == 'macos-latest' - - # Build WASM binary - - name: Build WASM binary - run: make wasm - if: matrix.os == 'ubuntu-latest' - - # Package the resulting WASM binary - - name: Create artifact (Linux - WASM) - run: zip hex_${{steps.current-release.outputs.tag_name}}_wasm.zip hex.wasm hex.js lib/utils.hbx - if: matrix.os == 'ubuntu-latest' - - # Add cosmocc to PATH + see https://redbean.dev/#install - - name: Add cosmocc to PATH - run: | - echo $HOME/cosmocc/bin >> $GITHUB_PATH - sudo wget -O /usr/bin/ape https://cosmo.zip/pub/cosmos/bin/ape-$(uname -m).elf - sudo chmod +x /usr/bin/ape - sudo sh -c "echo ':APE:M::MZqFpD::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" - sudo sh -c "echo ':APE-jart:M::jartsr::/usr/bin/ape:' >/proc/sys/fs/binfmt_misc/register" - if: matrix.os == 'ubuntu-latest' - - # Generate APE binary - - name: Generate APE binary - run: | - mv hex hex.native - make ape - if: matrix.os == 'ubuntu-latest' - - # Package the resulting APE binary - - name: Create artifact (Linux - APE) - run: zip hex_${{steps.current-release.outputs.tag_name}}_ape.zip hex lib/utils.hbx - if: matrix.os == 'ubuntu-latest' - - # Build (Windows) - - name: Build - run: make - shell: bash - if: matrix.os == 'windows-latest' - - # Build libs (Windows) - - name: Build - run: make utils.hbx - shell: bash - if: matrix.os == 'windows-latest' - - # Package the resulting Windows binary - - name: Create artifact (Windows) - run: Compress-Archive -Path "hex.exe", "lib/utils.hbx" -DestinationPath hex_${{steps.current-release.outputs.tag_name}}_windows_x86_64.zip - if: matrix.os == 'windows-latest' - - # Upload artifacts to current draft release - - name: "Upload to current release" - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - file: "hex_v*.zip" - overwrite: true - tag_name: ${{steps.current-release.outputs.tag_name}} - release_id: ${{steps.current-release.outputs.id }} - verbose: true
M CHANGELOG.mdCHANGELOG.md

@@ -1,6 +1,7 @@

<article> <h2>Changelog</h2> <ul> +<li><a href="#v480-0">v480-0</a></li> <li><a href="#v0.7.0">v0.7.0</a></li> <li><a href="#v0.6.0">v0.6.0</a></li> <li><a href="#v0.5.0">v0.5.0</a></li>

@@ -9,6 +10,12 @@ <li><a href="#v0.4.0">v0.4.0</a></li>

<li><a href="#v0.3.0">v0.3.0</a></li> <li><a href="#v0.2.0">v0.2.0</a></li> <li><a href="#v0.1.0">v0.1.0</a></li> +</ul> +<h3 id="v480-0">v480-0 &mdash; 2026-06-15</h3> + +<h4>Chores</h4> +<ul> + <li>Re-released using <a href="https://h3rald.com/conver">Convergent Versioning</a></li> </ul> <h3 id="v0.7.0">v0.7.0 &mdash; 2026-03-04</h3>

@@ -160,7 +167,7 @@

<h4>Chores</h4> <ul> <li>Split the source code to different files, and now relying on an <a - href="https://github.com/h3rald/hex/blob/master/scripts/amalgamate.sh">amalgamate.sh</a> script to + href="https://git.sr.ht/~h3rald/hex/tree/master/item/scripts/amalgamate.sh">amalgamate.sh</a> script to concatenate them together before compiling</li> </ul> <h3 id="v0.1.0">v0.1.0 &mdash; 2024-12-14</h3>
M LICENSELICENSE

@@ -1,6 +1,6 @@

MIT License -Copyright (c) 2024 Fabio Cevasco +Copyright (c) Fabio Cevasco Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
A VERSIONING.md

@@ -0,0 +1,7 @@

+This project uses the Convergent Versioning system. + +The version number is a 2-byte hexadecimal integer from 0x0000 to 0xFFFF, with the first three digitsindicating the project _dependability score_ and the last digit encoding the version impact, compatibility, and purpose. + +A version number compliant with Semantic Versioning can be derived from the project history, and will still be used if required by package managers or similar software. + +For more information, see the [Convergent Versioning specification](https://h3rald.com/conver).
M descriptiondescription

@@ -1,1 +1,1 @@

-A tiny, minimalist, slightly-esoteric concatenative programming lannguage. +A tiny, minimalist, slightly-esoteric, concatenative programming lannguage.
M hex.vimhex.vim

@@ -1,8 +1,8 @@

" Vim syntax file " Language: hex " Maintainer: Fabio Cevasco -" Last Change: 2024-12-10 -" Version: 0.3.0 +" Last Change: 2026-06-24 +" Version: 4800 if exists("b:current_syntax") finish

@@ -43,7 +43,7 @@ syntax keyword hexCommentTodo TODO FIXME XXX TBD contained

syntax match hexComment /;.*$/ contains=hexCommentTodo syntax region hexComment start=;#|; end=;|#; contains=hexCommentTodo -syntax match hexNumber ;0x[0-9a-f]\{1,8\}; +syntax match hexNumber ;\$[0-9a-f]\{1,8\}; syntax region hexString start=+"+ skip=+\\\\\|\\$"+ end=+"+
M releases/0.2.0.htmlreleases/0.2.0.html

@@ -13,12 +13,12 @@ <h4>Fixes</h4>

<ul> <li>Ensured that {{sym-dec}} is able to print negative integers in decimal format.</li> <li>Ensured that symbol identifiers cannot be longer than 256 characters.</li> - <li>Ensured that all symbols are correctly added to the stack trace.</li> + <li>Ensured that all symbols are correctly added to the stack trace.</li> </ul> <h4>Chores</h4> <ul> <li>Split the source code to different files, and now relying on an <a - href="https://github.com/h3rald/hex/blob/master/scripts/amalgamate.sh">amalgamate.sh</a> script to + href="https://git.sr.ht/~h3rald/hex/tree/master/item/scripts/amalgamate.sh">amalgamate.sh</a> script to concatenate them together before compiling</li> </ul>
A releases/480-0.html

@@ -0,0 +1,6 @@

+<h3 id="v480-0">v480-0 &mdash; 2026-06-15</h3> + +<h4>Chores</h4> +<ul> + <li>Re-released using <a href="https://h3rald.com/conver">Convergent Versioning</a></li> +</ul>
M scripts/web.hexscripts/web.hex

@@ -3,7 +3,7 @@

"./lib/utils.hbx" read "utils.hbx" ! "2026" "meta-year" : -"0.7.0" "meta-release" : +"480-0" "meta-release" : "web/assets" "d-assets" : "web/templates" "d-templates" : "web/contents" "d-contents" :
M src/hex.csrc/hex.c

@@ -23,7 +23,7 @@ #include <sys/wait.h>

#endif // Constants -#define HEX_VERSION "0.7.0" +#define HEX_VERSION "480-0" #define HEX_STDIN_BUFFER_SIZE 16384 #define HEX_INITIAL_REGISTRY_SIZE 512 #define HEX_REGISTRY_SIZE 4096

@@ -7221,7 +7221,7 @@ {

printf("\n" " _*_ _\n" " / \\hex\\*\n" - " *\\_/_/_/ v%s - (c) 2024-2025 Fabio Cevasco\n" + " *\\_/_/_/ v%s - (c) 2024-2026 Fabio Cevasco\n" " * \n", HEX_VERSION); printf("\n"
M src/hex.hsrc/hex.h

@@ -20,7 +20,7 @@ #include <sys/wait.h>

#endif // Constants -#define HEX_VERSION "0.7.0" +#define HEX_VERSION "480-0" #define HEX_STDIN_BUFFER_SIZE 16384 #define HEX_INITIAL_REGISTRY_SIZE 512 #define HEX_REGISTRY_SIZE 4096
M src/main.csrc/main.c

@@ -240,7 +240,7 @@ {

printf("\n" " _*_ _\n" " / \\hex\\*\n" - " *\\_/_/_/ v%s - (c) 2024-2025 Fabio Cevasco\n" + " *\\_/_/_/ v%s - (c) 2024-2026 Fabio Cevasco\n" " * \n", HEX_VERSION); printf("\n"
M web/contents/about.htmlweb/contents/about.html

@@ -46,7 +46,7 @@ <em>hexadecimal</em> and <em>spell</em>).

</p> <h3>About this web site</h3> <p>This web site aims to be very simple and minimalist, like hex itself. It is written in HTML with minimal CSS, and - it is processed using a minimal <a href="https://github.com/h3rald/hex/blob/master/scripts/web.hex" + it is processed using a minimal <a href="https://git.sr.ht/~h3rald/hex/tree/master/item/scripts/web.hex" target="_blank">static-site generator</a> implemented in hex itself. </p> </article>
M web/contents/get.htmlweb/contents/get.html

@@ -1,44 +1,10 @@

<article> <h2>Get Started</h2> - <p>The following pre-built binaries are available for download:</p> - <ul> - <li><a href="https://github.com/h3rald/hex/releases/download/v{{release}}/hex_v{{release}}_linux_x86_64.zip" - target="_blank">hex v{{release}} for Linux</a> (x86_64)</a></li> - <li><a href="https://github.com/h3rald/hex/releases/download/v{{release}}/hex_v{{release}}_macos_x86_64.zip" - target="_blank">hex v{{release}} for MacOS</a> (x86_64)</li> - <li><a href="https://github.com/h3rald/hex/releases/download/v{{release}}/hex_v{{release}}_macos_arm64.zip" - target="_blank">hex v{{release}} for MacOS</a> (ARM64)</li> - <li><a href="https://github.com/h3rald/hex/releases/download/v{{release}}/hex_v{{release}}_windows_x86_64.zip" - target="_blank">hex v{{release}} for Windows</a> (x86_64)</li> - <li><a href="https://github.com/h3rald/hex/releases/download/v{{release}}/hex_v{{release}}_ape.zip" - target="_blank">hex v{{release}}</a> (<a href="https://justine.lol/ape.html" - target="_blank">αcτµαlly - pδrταblε εxεcµταblε</a>) - </li> - <li><a href="https://github.com/h3rald/hex/releases/download/v{{release}}/hex_v{{release}}_wasm.zip" - target="_blank">hex - v{{release}}</a> (<a href="https://webassembly.org" target="_blank">WebAssembly</a> - &mdash; - <em>very</em> - experimental) - </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>Building from Source</h3> - <p>Building from source is easy: just run <code>make</code> after <a - href="https://github.com/h3rald/hex">cloning + <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

@@ -57,6 +23,17 @@ (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>

@@ -94,7 +71,7 @@ <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" + <p>If you use the Vim editor, you can use <a href="https://git.sr.ht/~h3rald/hex/tree/master/item/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>
M web/contents/home.htmlweb/contents/home.html

@@ -21,7 +21,7 @@ <li>Fully <strong>homoiconic</strong> (everything is data).</li>

<li>Implements a simple <strong>virtual machine</strong> with a bytecode compiler and interpreter.</li> <li>Includes a simple <strong>REPL</strong>.</li> <li>Includes an integrated <strong>help system</strong>.</li> - <li>Distributable through <strong>one single, <a href="https://github.com/h3rald/hex/blob/master/src/hex.c" + <li>Distributable through <strong>one single, <a href="https://git.sr.ht/~h3rald/hex/tree/master/item/src/hex.c" target="_blank">amalgamated C file</a></strong>, making it easier to embed in other programs and port to different platforms.</li> </ul>
M web/contents/learn.htmlweb/contents/learn.html

@@ -84,13 +84,13 @@ <p>Fiiiirst we start a hex REPL.</p>

<p>Then, we enter <code>$!5$$</code> and press <code>ENTER</code>. <code>$$5</code> gets <em>pushed on The Stack</em>, like this:</p> <pre><code> +-----------+ - | $5 | + | $5 | +-----------+</code></pre> <p>Then, we enter <code>$!3$$</code> on The Stack. Now there are two items on The Stack, like this:</p> <pre><code> +-----------+ - | $3 | + | $3 | +-----------+ - | $5 | + | $5 | +-----------+</code></pre> <p>Great, and finally, we are going to push the symbol {{sym--}} on the stack, because that's how postfix notation (a.k.a. <a href="https://en.wikipedia.org/wiki/Reverse_Polish_notation">Reverse Polish Notation</a>) works:

@@ -100,14 +100,14 @@ <p>Anyhow, what happens to The Stack now? Waait... wait...</p>

<pre><code> * * - * +-----------+ - | $3 | + | $3 | +-----------+ - | $5 | + | $5 | +-----------+</code></pre> <p>...magic! Real quick, <code>$:-$$</code> takes two items from The Stack, performs the subtraction, aaaand pushes the result back on The Stack, that now looks like this:</p> <pre><code> +-----------+ - | $2 | + | $2 | +-----------+</code></pre> <p>Symbols ain't that bad after all. And yes, The Stack is AWESOME! Did you know that if you use postfix notation you will NEVER ever need to use parenthesis when performing math operations to tweak operator
M web/contents/lib.htmlweb/contents/lib.html

@@ -1,7 +1,7 @@

<article> <h2>Standard Library</h2> <p>hex comes with a standard library providing common functionality implemented in hex itself.</p> - <p>At present, it only comprises <a href="https://github.com/h3rald/hex/blob/master/lib/utils.hex" + <p>At present, it only comprises <a href="https://git.sr.ht/~h3rald/hex/tree/master/item/lib/utils.hex" target="_blank">utils.hex</a>, a collection of common utility symbols, which is distributed in <code>.hbx</code> format along with the hex executable. To pre-load this file, you can start hex like this:</p>