Qter Documentation

QAT Standard Library

Lucky for you, you get a lot of macros built into the language! The QAT standard library is defined at src/qter_core/prelude.qat and you can reference it if you like.

sub <register> <number>
sub <register> <number>

Subtract a number from a register

inc <register>
inc <register>

Increment a register

dec <register>
dec <register>

Decrement a register

move <register1> to <register2>
move <register1> to <register2>

Zero out the first register and add its contents to the second register

set <register1> to <register2>
set <register1> to <register2>

Set the contents of the first register to the contents of the second while zeroing out the contents of the second

set <register> to <number>
set <register> to <number>

Set the contents of the first register to the number specified

if solved <register> <{}> [else <{}>]
if solved <register> <{}> [else <{}>]

Execute the code block if the register is zero, otherwise execute the elseelse block if supplied

if not-solved <register> <{}> [else <{}>]
if not-solved <register> <{}> [else <{}>]

Execute the code block if the register is not zero, otherwise execute the elseelse block if supplied

if equals <register> <number> <{}> [else <{}>]
if equals <register> <number> <{}> [else <{}>]

Execute the code block if the register equals the number supplied, otherwise execute the elseelse block if supplied

if not-equals <register> <number> <{}> [else <{}>]
if not-equals <register> <number> <{}> [else <{}>]

Execute the code block if the register does not equal the number supplied, otherwise execute the elseelse block if supplied

if equals <register1> <register2> using <register3> <{}> [else <{}>]
if equals <register1> <register2> using <register3> <{}> [else <{}>]

Execute the code block if the first two registers are equal, while passing in a third register to use as bookkeeping that will be set to zero. Otherwise executes the elseelse block if supplied. All three registers must have equal order. This is validated at compile-time. The equality check is implemented by decrementing both registers until one of them is zero, so the bookkeeping register is used to save the amount of times decremented.

if not-equals <register1> <register2> using <register3> <{}> [else <{}>]
if not-equals <register1> <register2> using <register3> <{}> [else <{}>]

Execute the code block if the first two registers are not equal, while passing in a third register to use as bookkeeping that will be set to zero. Otherwise executes the elseelse block if supplied. All three registers must have equal order. This is validated at compile-time. The equality check is implemented identically to if equals ... using ...if equals ... using ....

loop <{}>
!continue
!break
loop <{}>
!continue
!break

Executes a code block in a loop forever until the breakbreak label or a label outside of the block is jumped to. The breakbreak label will exit the loop and the continuecontinue label will jump back to the beginning of the code block

while solved <register> <{}>
!continue
!break
while solved <register> <{}>
!continue
!break

Execute the block in a loop while the register is zero

while not-solved <register> <{}>
!continue
!break
while not-solved <register> <{}>
!continue
!break

Execute the block in a loop while the register is not zero

while equals <register> <number> <{}>
!continue
!break
while equals <register> <number> <{}>
!continue
!break

Execute the block in a loop while the register is equal to the number provided

while not-equals <register> <number> <{}>
!continue
!break
while not-equals <register> <number> <{}>
!continue
!break

Execute the block in a loop while the register is not equal to the number provided

while equals <register1> <register2> using <register3> <{}>
!continue
!break
while equals <register1> <register2> using <register3> <{}>
!continue
!break

Execute the block in a loop while the two registers are equal, using a third register for bookkeeping that will be zeroed out at the start of each iteration.

while not-equals <register1> <register2> using <register3> <{}>
!continue
!break
while not-equals <register1> <register2> using <register3> <{}>
!continue
!break

Execute the block in a loop while the two registers are not equal, using a third register for bookkeeping that will be zeroed out at the start of each iteration.