FlipJump in 5 minutes¶
A single-page cheat sheet covering everything you need to start reading and writing FlipJump.
The instruction¶
a;b // flip the bit at address a, then jump to address b
That’s the whole language. Variables, conditionals, arithmetic — all built from this.
Shorthands:
Form |
Meaning |
|---|---|
|
flip a, jump to b |
|
flip a, fall through |
|
jump to b, no flip (formally: flip bit 0) |
|
bare self-loop / placeholder |
Halt: jump-to-self with flip-address OUTSIDE the instruction’s own body. Canonical: stl.loop → ;$ - dw.
Lexical¶
Comments |
|
Numbers |
|
Strings |
|
Identifiers |
|
Line continuation |
|
Operators (highest → lowest precedence)¶
# (prefix bit-length)
* / %
+ -
<< >>
< <= > >=
== !=
&
^
|
?: (ternary)
Special: $ is the current bit-address.
Keywords¶
Keyword |
Use |
|---|---|
|
define a macro |
|
open a namespace block |
|
repeat body N times with |
Directives (built-in, not macros)¶
Directive |
Use |
|---|---|
|
align current address to a multiple of N words |
|
reserve N bits of empty storage |
|
move the assembler cursor to bit-address ADDR |
|
XOR VAL into word at DST, then optionally jump to JMP |
Built-in names¶
Name |
Meaning |
|---|---|
|
machine word width (bits) — set at compile time |
|
2 * w — size of one instruction in bits |
|
w + #w — offset to value bit inside a packed variable |
|
the namespace name (not a type keyword) |
The 10 macros every program uses¶
Macro |
What it does |
|---|---|
|
minimal init (I/O opcode only) |
|
full init (I/O + pointers + hex tables + stack) |
|
print a literal string |
|
print one ASCII byte |
|
halt (self-loop) |
|
declare an n-bit variable |
|
branch on n-bit value (zero → l0 else l1) |
|
dst += src |
|
print x as decimal |
|
declare an n-nibble hex variable (faster arithmetic) |
Program skeleton¶
stl.startup_and_init_all // initialise
// your code
stl.loop // halt
// data variables go below the halt
my_var: bit.vec 32, 0
I/O addresses¶
Address |
Meaning |
|---|---|
|
the I/O opcode (after |
|
the next input bit (runtime auto-loads here on each read) |
Where to go next¶
Standard Library — all ~300 macros documented
Language Reference — full prose explanations
Glossary — definitions of FJ-specific terms
How the STL works — the meta-pattern that makes the library possible