Skip to content

Afth64 Examples

Sara Berman edited this page Mar 7, 2026 · 2 revisions

Afth64/Examples

Dictionary Code

This is the dictionary as used in all examples:

~+ HLH+G
~- H-LH+G
~* HLH*G
~/ HLH/G
~% HLH%G
~<< H<G
~>> H>G
~++ H^G
~-- HVG
~IC ,G
~OC H.
~ID [G
~OD H]
~IH (G
~OH H)
~END _Q
~ABS H:G
~NEG H:-G
~DUP HGG
~L_NZ HL_S
~JNZ HIHLIS
~JUMP HI_^LIS
~DROP IHI
~POP H
~PUSH G
~DROP2 INI
~POP2 N
~PUSH2 M
~JSIG HIOUIS
~SI OG
~SI2 PG
~SI_S2 OI
~SI2S2 PI
~CR _DG
~LF _AG
~S->S2 HM
~S2->S NG
~S=S2 HGM
~S2=S NMG

Examples

Hello, World!

A simple Hello World:

LF
|Hello, World!
{_2G} JSIG
{_2G} JUMP
OC {_2G} NEG JUMP
END

Add Two Numbers

This adds two base-10 numbers and outputs the result in base-10:

ID ID + OD END

Echo

Similar to the Cat program, the Echo program outputs input, but then quits after outputting an LF

IC DUP OC LF - L_NZ
END

RPN Calc

Simple single-equation five-function integer RPN Calculator. Put 0 . at end of line to output result and quit.

LF
|RPN CALC
{_2G} JSIG
{_2G} JUMP
OC {_2G} NEG JUMP
ID ID IC IC DROP {_2G} JUMP
ID IC IC DROP
DUP `. - {_2G} JNZ
DROP DROP OD END
DUP `+ - {_2G} JNZ
DROP + {_4G} NEG JUMP
DUP `- - {_2G} JNZ
DROP - {_6G} NEG JUMP
DUP `* - {_2G} JNZ
DROP * {_8G} NEG JUMP
DUP `/ - {_2G} JNZ
DROP / {_AG} NEG JUMP
DUP `% - {_2G} JNZ
DROP % {_CG} NEG JUMP
DROP LF
|ERROR...
{_2G} JSIG
{_2G} JUMP
OC {_2G} NEG JUMP
END

Current bugs: First operator requires exactly two numbers inputted before it. Any later operators require exactly one number to be entered before it.

Clone this wiki locally