Somp
Jump to navigation
Jump to search
Somp is an esolang made by me (User:Shazun_bhasfu)! It's a single char command, stack-based esolang that also has 'teleports' (basically labels)
Commands
Command | Action |
---|---|
^ | Append 0 to current stack |
; | Halt or return to previous jump position if any |
. | Pop from stack and output as character |
, | Input character to stack (from buffer or user) |
+ | Pop 2 values and push their sum |
- | Negate top of stack value |
: (after letter) | Define label at this position (e.g., `A:`) |
[a-zA-Z] (alone) | Call/jump to label defined by that letter (e.g., `A`) |
@ | Jump forward to next label(s) depending on number of '@' |
/ | Jump backward to previous label |
! | Pop top; if nonzero, continue; else skip next instruction |
& | Reverse current stack |
# | Push index of last element in current stack (length-1) |
Duplicate top stack value | |
% | Pop top, push tens digit and units digit separately |
° | Move top element to other stack |
? | Pop top, push 0 if >= 0 else 1 |
$ | Pop top of stack |
" | Switch current stack |
* | Swap both stacks and current stack pointer accordingly |
~ | Swap top two stack elements |
` | Pop top, push length of string representation of that number |
´ | Pop top, reverse that many elements at top of stack |
= | Push length of string representation of top stack element minus 1 |
Examples
Hello, World!
^104^101^108^108^111^32^119^111^114^108^100^10&............
or
:,|^10-+!@/:^0&:|!;./ (assuming you inputed hello world!)
Truth machine
,^48-+|!Z!;:49./Z:^48.^10.^0;
Multiplication
(any number\nnumber\n)
N$"N$°"^1+M$P;M::^1-+|!@~|°~/::$$*^0&@::~|!;~+/;N:,:,|^10-+!@^48-+/ :$^1-&@ :~|^1+!;~0+/ P::= !@%~ / :&^1-&@ :|^1+!;^48+.
99 bottles of beer
^99°:pb*|°!;/;P:=!@@:%~^48+.^48+.;:^48+.;;p:*|P^1-+^32.*;b:^098.^111.^116.^116.^108.^101.^115.^032.^111.^110.^032.^119.^097.^108.^108.^010.^032.^098.^111.^116.^116.^108.^101.^115.^032.^111.^102.^032.^098.^101.^101.^114.^010.^032.^116.^097.^107.^101.^032.^049.^032.^100.^111.^119.^110.^032.^097.^110.^100.^032.^112.^097.^115.^115.^032.^097.^114.^111.^117.^110.^100.^010.;
calculator
(number\nnumber\nop\n)
N$"N$OP^10.;O:°",^43-+|!E!;-+;E:++^;N:,:,|^10-+!@^48-+/:$^1-&@ :~|^1+!;~0+/P::|?^1-+!p&@::=!@%~/ :&^1-&@::|^1+!;^48+./ p:^45.-;
input string (use \n to end the string!) and mov to next letter in sequence
:,|^10-+!@/:^1-&@ 'lloeh-1' :^1+|!@°/ :*^0&@ :|!@./ :^10.;
Note
the intepreter is at User:Shazun_bhasfu and also if you want input \n or use predefined buffer, you must use python3 main.py program.somp -ci, the ci allows you enter a text to use it instead by one, it has so if you input \\n it replaced with \n, with allows you use \n with is important for these examples!
also somp dont care about spaces or newlines, so you can custime it or even... (using exmaple 99 beers of bottles) ^99°:pb*|°!;/; P:
=!@@ :%~^48+.^48+.; :^48+.;
p:
* |P^1-+^32. *
b:
^098.^111.^116.^116.^108.^101.^115.^032.^111.^110.^032.^119.^097.^108.^108.^010.^032.^098.^111.^116.^116.^108.^101.^115.^032.^111.^102.^032.^098.^101.^101.^114.^010.^032.^116.^097.^107.^101.^032.^049.^032.^100.^111.^119.^110.^032.^097.^110.^100.^032.^112.^097.^115.^115.^032.^097.^114.^111.^117.^110.^100.^010.