Halfwit is an experimental golfing language that fits most commands in half a byte.

Overview

Halfwit

Halfwit is an experimental golfing language that fits most commands in half a byte. It's stack-based.

Usage

npm install halfwit
node main.js <filename> [single string of flags] [inputs]

Or clone this repo.

Or in node.js:

const halfwit = require('halfwit')

Or in a website:

<script src='/path/to/halfwit.js'>script>

Or, you can try it online at DSO.

Flags

Halfwit has several flags:

  • e - execute the filename as code
  • A - print as chars
  • c - print compiled code
  • C - count source length in Halfwit codepage
  • s - compress list / int
  • t - print tokens
  • p - print parsed tokens
  • h - print flag help menu

Builtins

Some builtins take up .5 bytes, some 1, and some 1.5.

.5 bytes

  • [ - condition ([...;)
  • M - map (M...;)
  • { - while (condition) do stuff ({...;...;), condition = first part
  • ;; - terminate structure
  • + - Addition, vectorising
  • * - Multiplication, vectorising
  • J - join - append / prepend / pair
  • > - Starts a compressed int - >...< / adds to a compressed int list >...>...<
  • < - end int / intlist (see above) / length / range 0...n-1
  • N - negate / reverse
  • f - flatten / square
  • b - base conversion:
    • Int, int -> to_base
    • Int, list -> to-custom-base
    • List, int -> from-base
    • list, list -> from-custom-base
  • : - Duplicate
  • $ - Swap
  • ? - Take input
  • k - Digraph modifier

Note that all of these can be represented as a single character as well as the encoding.

1 byte

  • k* / e - exponentiation, vectorising
  • k+ / / - floor division
  • k[ / | - [...|...; else in an if block, otherwise |...; -> if not
  • kM / ( -> for (same stack) - (...;
  • k; / % - modulo (vectorising)
  • k{ / E - Eqiuvalent of (n
  • kN / n -
    • in ( / M / F: Push context (loop var)
    • in global scope: Push 1
  • kJ / S - Sum / is prime
  • k? / i - index value (s) into list / bitwise xor
  • k< / l - Comparison (less than)
  • kf / F - Filter - F...;
  • kb / R - Reduce R...;
  • k: / _ - Pop stack
  • k> / } - rotate stack right
  • k$ / r - range (inclusive)
  • kk : useful constants

1.5 bytes

  • kk[ / 0 - 100

  • kkM / 1 - 256

  • kk{ / 2 - 26

  • kk; / 3 - 50

  • kk+ / 4 - [0, 1]

  • kk* / 5 - 128

  • kkJ / 6 - 64

  • kk> / 7 - 32

  • kk< / 8 - 16

  • kkN / 9 - 1000

  • kkf / s - sort / prime factors

  • kkb / Z:

    • list, list -> zip
    • int, list -> repeat (vectorised)
    • list, int -> repeat
    • int, int -> repeat
  • kk: / D - is a divisible by B? (vectorising)

  • kk$ / W - stack = [stack]

  • kk? / , - prettyprint with trailing newline

  • kkk / . - Print as chars without trailing newline

Not scored

These are debugging instructions that aren't included in the codepage.

  • x - Print stack
You might also like...

Bitburner-bbpm - An experimental package manager for the game Bitburner.

BPPM - BitBurner Package Manager An experimental package manager for the game Bitburner. Install Instructions Download the latest release of bbpm.js.

Mar 24, 2022

experimental web browser optimized for rabbit-holing

experimental web browser optimized for rabbit-holing

Cartographist Cartographist is an experimental web browser optimized for rabbit-holing. Instead of opening new windows (with cmd-click), Cartographist

Jan 2, 2023

An experimental framework-aware Firebase CLI

Firebase Experimental framework-aware CLI Usage $ npm i -g firebase-frameworks $ cd MY-APP $ firebase-frameworks init $ firebase-frameworks build $

Dec 27, 2022

This experimental library patches the global custom elements registry to allow re-defining or reload a custom element.

Redefine Custom Elements This experimental library patches the global custom elements registry to allow re-defining a custom element. Based on the spe

Dec 11, 2022

[Experimental] Browse local files using the non-standard File System Access API

[Experimental] Browse local files using the non-standard File System Access API

jupyterlab-filesystem-access Browse local files using the non-standard Web Browser File System Access API. ⚠️ This extension is compatible with Chromi

Apr 14, 2022

[Experimental] Browse local files using the non-standard File System Access API

[Experimental] Browse local files using the non-standard File System Access API

jupyterlab-filesystem-access Browse local files using the non-standard Web Browser File System Access API. ⚠️ This extension is compatible with Chromi

Apr 15, 2022

Experimental keycast plugin for Vim/Neovim

Experimental keycast plugin for Vim/Neovim

vim-keycasty Introduction Keycasty is an experimental keycast plugin for Vim/Neovim. Still work in progress. Use it just for testing. Design Keycasty

Apr 30, 2022

An experimental syntax highlighter web app bot based on Telegram's WebApp update.

Syntax Highlighter WebApp Inspired by zubiden/tg-web-bot-demo. Try the demo bot running here: @syntaxyybot Recently Telegram released a big update for

Nov 8, 2022

An experimental plugin to preview and insert block patterns in WordPress.

An experimental plugin to preview and insert block patterns in WordPress.

Block Pattern Explorer The Block Pattern Explorer is an experimental WordPress plugin based heavily on the work currently being done in Gutenberg. The

Oct 19, 2022
Releases(v1.0.1)
Owner
Chunkybanana
I work on Pluto.
Chunkybanana
Find a local sports match that fits your skill level. Built with NextJS and AWS.

MatchUp MatchUp Find local sport matches Beta walkthrough About The Project Looking for a fun and easy way to meet up and play sports with locals in y

MatchUp 7 Oct 27, 2022
Serv is a platform for MSMEs to be able to easily find good vendors or services that are fits their needs.

Description Serv is a platform for MSMEs to be able to easily find good vendors or services that are fits their needs. For example, if someone wants t

null 3 Oct 3, 2022
hyper-experimental hyper-text language

HyperTode I'm designing + making an alternative web framework for fun! HyperTode will be my JSX alternative. What's the plan? ?? Use the browser API a

Lu[ke] Wilson 7 Dec 8, 2022
Dead simple, single file, tiny byte formatter

tiny-byte-size Dead simple, no configuration needed, tiny byte formatter npm install tiny-byte-size Usage const byteSize = require('tiny-byte-size')

Mathias Buus 17 Aug 24, 2022
The commercial Cheesgle Byte.

Cheesgle-Byte The commercial Cheesgle Byte. https://one.byte.cheesgle.com/ The LICENSE to this software is provided in the file marked LICENSE Contrib

coding398 7 Oct 20, 2022
All terminal commands in one place (you can Contribute to it by putting latest commands and adding Readme)

Terminal-Commands All basic terminal commands in one place Show some ❤ by some repositories You can contribute to this readme If you to contribute wit

Shehzad Iqbal 7 Dec 15, 2022
i18n-language.js is Simple i18n language with Vanilla Javascript

i18n-language.js i18n-language.js is Simple i18n language with Vanilla Javascript Write by Hyun SHIN Demo Page: http://i18n-language.s3-website.ap-nor

Shin Hyun 21 Jul 12, 2022
When a person that doesn't know how to create a programming language tries to create a programming language

Kochanowski Online Spróbuj Kochanowskiego bez konfiguracji projektu! https://mmusielik.xyz/projects/kochanowski Instalacja Stwórz nowy projekt przez n

Maciej Musielik 18 Dec 4, 2022
Write "hello world" in your native language, code "hello world" in your favorite programming language!

Hello World, All languages! ?? ?? Write "hello world" in your native language, code "hello world" in your favorite language! #hacktoberfest2022 How to

Carolina Calixto 6 Dec 13, 2022
Experimental URL->CID index using b trees (chunky-trees from @mikeal)

ipfs-url-index Experimental IPFS index for URL->CID, implemented using chunky-trees B-Tree implementation. API Server Run node main.js to start the ap

Ilya Kreymer 2 Mar 14, 2022