# Omicron

Paradigm(s) Imperative Dr. Kilobyte 2023 Cell-based Turing complete Omicron interpreter `.omi`

Omicron is a Turing-complete esoteric programming language made by Dr. Kilobyte in 2023. Full implementation at GitHub
Subject to change with further development

## Instructions

Pointer starts at cell 0. Negative addresses are valid.
n denotes a number.

Name Description
(any number) Set current memory cell
!f Import program from file f and insert it into current program (pre-execution)
:n Mark position in program as n
@n Get value at memory cell n (can be nested, e.g. @@@n)
Pointer
> Increment memory pointer
< Decrement memory pointer
>> n Move memory pointer forward n
<< n Move memory pointer back n
~ n Move memory pointer to n
Arithmetic
++ Increment current memory cell
-- Decrement current memory cell
+ n Add n to current memory cell
- n Subtract n from current memory cell
* n Multiply current memory cell by n
/ n Divide current memory cell by n
// n Floor-divide current memory cell by n
^ n Raise current memory cell to the nth power
% n Divide current memory cell by n and set to the remainder
\ n Set current memory cell to its nth root
log n Set current memory cell to its base-n logarithm
round Round current memory cell
ceil Round up current memory cell
floor Round down current memory cell
sin Set current memory cell to its sine
cos Set current memory cell to its cosine
tan et current memory cell to its tangent
abs Set current memory cell to its absolute value
fact n Set current memory cell to n factorial
rand n1 n2 Set current memory cell to random number between n1 and n2 (inclusive)
pi Set current memory cell to pi
e Set current memory cell to e
Comparison
eq n Sets current memory cell to 1 if it equals n, else 0
gt n Sets current memory cell to 1 if it is greater than n, else 0
gte n Sets current memory cell to 1 of it is greater then or equal to n, else 0
lt n Sets current memory cell to 1 if it is less than n, else 0
lte n Sets current memory cell to 1 of it is lesser then or equal to n, else 0
not Set current memory cell to 1 if it is 0, else 0
Flow
goto n Goto marker n
qoto n1 n2 Goto marker n1 if current memory cell is not zero, otherwise goto marker n2
wait Pause program until `Enter` is pressed.
stop End program
I/O
input Accept an integer value (0 if none given) and sets current memory cell
inputc Accept a single character (first if more than one given) and sets current memory cell to ASCII value
read f n Read nth byte (zero-based) from file f and set current memory cell
size f Set current memory cell to size of file f (bytes)
print Print current memory cell
printc Print ASCII character of current memory cell
write f Write ASCII char of current memory cell to file f (truncates file)
awrite f Append ASCII char of current memory cell to file f
writeb f Write current memory cell to file f (binary) (truncates file)
awriteb f Append current memory cell to file f (binary)

## Examples

Newlines are treated as spaces, so programs can be written on single lines or across multiple lines.

### Hello, World!

```72 printc
101 printc
108 printc printc
111 printc
44 printc
32 printc
87 printc
111 printc
114 printc
108 printc
100 printc
33 printc
```

### Cat

```inputc printc
```

### Truth machine

```input qoto 1 2 :1 print goto 1 :2
```

### Pythagorean theorem

```input ^ 2 > input ^ 2 + @0 \ 2 print
```

### Fibonacci sequence

```input - 2 > 1 print > 1 print > :1 @1 + @2 print << 2 @2 > @3 > ~ 0 -- qoto 2 3 :2 ~ 3 goto 1 :3 wait
```

Alternative; only final output

```input - 2 > 1 > 1 > :1 @1 + @2 << 2 @2 > @3 > ~ 0 -- qoto 2 3 :2 ~ 3 goto 1 :3 ~ 3 print wait
```