Sreg
Jump to navigation
Jump to search
Sreg (Six REGisters) is an esolang by User:ChuckEsoteric08.
Specification
Sreg uses six registers as memory:A, B, C, D, E and F.
Note that |A
would return value of register A
.
Command | Function |
---|---|
++ A B C |
Add value of register B to value of register A , storing result in register C
|
-- A B C |
Subtract value of register B from value of register A , storing result in register C . If value of A is less than value of B then error.
|
** A B C |
Multiply value of register B by value of register A , storing result in register C
|
// A B C |
Divide value of register A by value of register B , storing result in register C . If value of A is not divisible by value B or value of B is zero then error
|
1+ A |
Increment register A
|
1- A |
Decrement register A . If value of A is zero then error
|
!! A |
Declare label A
|
:: A |
Goto label A
|
~~ A B C |
Set register A to ASCII value of B -th letter in String C with first character being 1, character after it is 2 and so on. If B is bigger than length of string C then set A to 0
|
.. A |
Output Register A as ASCII character |
>> A B |
Skip next instruction if register A is not B
|
^^ A B |
Set register A to the value of register B
|
&& A |
Set register A to zero
|
Examples
Print "HI"
1+ A 1+ A 1+ A 1+ A 1+ A 1+ A 1+ A 1+ B 1+ B 1+ B 1+ B 1+ B 1+ B 1+ B 1+ B 1+ B 1+ B ** A B A 1+ A 1+ A .. A 1+ A .. A
ALWCIDFEC interpreter
Replace Your_Program
with ALWCIDFEC program.
!! Interpreter 1+ D ~~ F |D Your_Program >> F 0 :: halt >> F 43 :: + >> F 45 :: - >> F 91 :: [ >> F 93 :: ] >> F 42 :: * >> F 47 :: / >> F 40 :: ( >> F 41 :: ) >> F 52 :: 4 >> F 49 :: 1 >> F 123 :: { >> F 125 :: } :: Interpreter !! + 1+ A :: Interpreter !! - 1- A :: Interpreter !! * 1+ B :: Interpreter !! / 1- B :: Interpreter !! 4 1+ C :: Interpreter !! 1 1- C :: Interpreter !! [ >> A 0 :: 1nest :: Interpreter !! 1nest 1+ D ~~ F |D Your_Program >> F 91 :: 1incloop >> F 93 :: 1decloop :: 1nest !! 1incloop 1+ E :: 1nest !! 1decloop >> E 0 :: Interpeter 1- E :: 1nest !! ] >> A 0 :: Interpreter !! 1nestback 1- D ~~ F |D Your_Program >> F 93 :: 1incloopback >> F 91 :: 1decloopback :: 1nestback !! 1incloopback 1+ E :: 1nestback !! 1decloopback >> E 0 :: Interpreter 1- E :: 1nestback !! ( >> B 0 :: 2nest :: Interpreter !! 2nest 1+ D ~~ F |D Your_Program >> F 40 :: 2incloop >> F 41 :: 2decloop :: 2nest !! 2incloop 1+ E :: 2nest !! 2decloop >> E 0 :: Interpeter 1- E :: 2nest !! ) >> B 0 :: Interpreter !! 2nestback 1- D ~~ F |D Your_Program >> F 41 :: 2incloopback >> F 40 :: 2decloopback :: 2nestback !! 2incloopback 1+ E :: 2nestback !! 2decloopback >> E 0 :: Interpreter 1- E :: 2nestback !! { >> C 0 :: 3nest :: Interpreter !! 3nest 1+ D ~~ F |D Your_Program >> F 123 :: 3incloop >> F 125 :: 3decloop :: 3nest !! 3incloop 1+ E :: 3nest !! 3decloop >> E 0 :: Interpeter 1- E :: 3nest !! } >> C 0 :: Interpreter !! 3nestback 1- D ~~ F |D Your_Program >> F 125 :: 3incloopback >> F 123 :: 3decloopback :: 3nestback !! 3incloopback 1+ E :: 3nestback !! 3decloopback >> E 0 :: Interpreter 1- E :: 3nestback !! halt