Registers, Memory, and Stack

There are two registers, a and b. You can also use these registers as pointers, so [a and [b mean “The memory addresses identified by the values in register a and register b“. For example, if a contained the value 10, then [a refers to memory address 10. Memory is unlimited (theoretically, but in practice is limited by the amount of physical memory you have), and so is the Stack. You cannot directly refer to the stack and there is no stack pointer (so there is no way to directly manipulate the stack). In processors, memory is typically addressed by BYTES, WORDS, LONGWORDS, or QUADWORDS. There is no such addressing scheme in bAdkOde. Also, in normal memory, the largest value a typical memory location (usually a byte) can hold is FF16 (25510). In bAdkOde however, the largest number a location can hold really depends on the implementation. I implemented this grammar in Perl and so depending on how it was built, you can have -253 to 253 (32-bit ints and double floats), or -263 to 264 – 1 (64-bit ints and double floats), or -2113 to 2113 (64-bit ints and quadruple floats). These limits also apply to the value that can be stored in the registers or on the stack.

Binary-operator statements

There are three binary operators: > or move, + or add, and or subtraction.

> or move

```Usage:
> [src] [dest]
```

The move operator takes two operands. The first operand (source) can either be a number, register, or a memory location. The second operand (destination) can either be a register or a memory location.

```Examples:
# move the value 10 to register a
>10a

#move the value 10 to the location that a points to
>10[a

#move the value in a to the location pointed to by a
>a[a
```

```Usage:
+ [src] [src2/dest]
```

The add operator takes two parameters. It adds the values represented by both operands and stores it in the location represented by the second. The first operand (source) can either be a number, register, or a memory location. The second operand (destination) can either be a register or a memory location.

```Examples:
# add the values of the a and b register and store the result in b
+ab

# add the value in the a register and the value in the memory
# location that a points to, and then store the result in that
# memory location
+a[b

#add 3 to the value in register a
+3a

# add two memory locations together and store the value in
# the second
+[a[b
```

or subtract

```Usage:
- [src] [src2/dest]
```

The subtract operator takes two parameters. It subtracts the value represented by the first operand from the value represented by the second operand and stores it in the location represented by the second. The first operand (source) can either be a number, register, or a memory location. The second operand (destination) can either be a register or a memory location.

```Examples:
# negate the value in register a
>0b
-ab

# subtract two memory locations together and store the value in
# the second

-[a[b
```