PREG
Jump to navigation
Jump to search
Paradigm(s) | imperative |
---|---|
Designed by | User:EZ132 |
Appeared in | 2021 |
Memory system | register based |
Computational class | Unknown |
Reference implementation | Unimplemented |
File extension(s) | .prg , .preg , .proreg |
PREG is a register-based programming language.
Overview
The data structure of PREG is an array of registers, initially at zero. Each register is indexed by a program, and holds a nonnegative integer. (This is where the name PREG comes from: PRogram REGister.)
PREG has n commands:
Command | Description |
---|---|
,(X)
|
Input into register X |
.(X)
|
Output register X |
+(X)
|
Increment register X |
-(X)
|
Decrement register X |
?(X)
|
Run program X if register X is non-zero |
(X);(Y)
|
Copy the value of register X into register Z, where Z is the concatenation of X and Y |
(X):(Y):(Z)
|
Copy the value of register X into register W, where W is obtained by replacing the first occurrence of Y in X by Z |
[X]
|
Run X while register X is nonzero |