Addit
Jump to navigation
Jump to search
Addit is a language where data is stored in an infinite grid of crumbs(quaternary digits).
Specifications
The crumb grid has two pointers A and B. All crumbs are initialized to 1. The program starts with A selected. Pointer A stars at (0,0) (the center) and pointer B starts at (1,0). The pointers can be at the same position. Oh yeah, the cells wrap too, and whitespace is ignored.
Commands
The cells each pointer is looking at will be referred to as cell A and cell B.
Command | Description |
---|---|
>
|
Move the selected pointer right in the crumb grid |
<
|
Move the selected pointer left in the crumb grid |
^
|
Move the selected pointer up in the crumb grid |
v
|
Move the selected pointer down in the crumb grid |
+(arrow)
|
Add cell A and cell B and set the cell at the selected pointer to the result. The following arrow tells the program where to put a second crumb if necessary. |
-
|
like the add command, but it's subtraction (cell A - cell B) and there is no argument. |
S
|
Switch the selected pointer |
`(arrow)(2 to 4)
|
Print the character corresponding to the cell at the selected pointer and the (2 to 4) crumbs in direction (arrow) |
label x
|
define label x |
go x
|
If the cell at the selected pointer is 1, jump to label x. |
(...)
|
Everything within the parentheses is ignored (comment) |
I(arrow)
|
Take one character from input and put it's ascii value in direction (arrow) from cell at selected pointer |
Examples
Hello World
+> < - >> - <<< `>3 (print H) > S ^ S +> +> > - > +> <<< `>3 (print e) >> +> +> > - <<< `>3 `>3 (print ll) >>>> - << `>2 (print o) < P>2 (print ,) > - < `>2 (print space) - > +> > - <<< `>3 (print W) > +> > +< +> << `>3 (print o) > +< > +v > - <<< `>3 (print r) > - > - > +> +^ <<< `>3 (print l) >> - - << `>3 (print d) >> - > +v << `>2 (print !)
Truth-machine
I< << +> +> go pre_one (take input and checks if it's 1) - - >> P<2 (print 0) go terminate (end the program by jumping to label at last line) label pre_one - - >> (return cell to original value and go to start of number) label oneloop P<2 (print 1) go oneloop (the go will always run on a 3) label terminate
Thankfully, both 1 and 0 start with 3 in quaternary.
Computational class
idk lol