Permalink
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (26 sloc) 2.09 KB

Packed Stax

Stax is written using the 95 printable ASCII characters. These are easy to type on most keyboards, but for golfing applications, this is pretty wasteful. Therefore, stax code has an alternative representation called "PackedStax". They can be executed by the same interpreter with no additional switches or settings. The high bit of the first byte is the toggle for detecting the difference. Converting to packed stax representation reduces code bloat by about 18%.

How does it work?

The stax code is converted to a big integer using the ASCII characters as base 95. Then the number is converted to base 256, which gives a byte array. There's a little extra piece to make sure leading 0s aren't lost.

Portability

For display purposes, a clipboard-friendly variant of CP437 is used to display packed stax. 00 and FF were replaced so they can survive a round-trip through a web browser and clipboard.

Packed Stax character set

This is the character set used to present packed stax. The charcters themselves aren't meaningful. It's identical to CP437 except for 00 and FF.

__ _0 _1 _2 _3 _4 _5 _6 _7 _8 _9 _a _b _c _d _e _f
0_ ø
1_ §
2_ ! " # $ % & ' ( ) * + , - . /
3_ 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4_ @ A B C D E F G H I J K L M N O
5_ P Q R S T U V W X Y Z [ \ ] ^ _
6_ ` a b c d e f g h i j k l m n o
7_ p q r s t u v w x y z { | } ~
8_ Ç ü é â ä à å ç ê ë è ï î ì Ä Å
9_ É æ Æ ô ö ò û ù ÿ Ö Ü ¢ £ ¥ ƒ
a_ á í ó ú ñ Ñ ª º ¿ ¬ ½ ¼ ¡ « »
b_
c_
d_
e_ α ß Γ π Σ σ µ τ Φ Θ Ω δ φ ε
f_ ± ÷ ° · ² Δ