0(nop^)

From Esolang
Jump to navigation Jump to search

0(nop^) is an esoteric programming language with numeric function names that are evaluated with the " ^ " command. This is the only form of flow control.

Commands

+, -, *, /, %, <, >, and = work as expected.

_ : Negate tos (top of stack).

~ : Replace tos with 8-bit sine wave table look-up.

? : Replace tos with random number if tos is not zero, else with the last random number given.

$ : Duplicate tos.

\ : Swap top two elements.

@ : Rotate top three elements.

& : Returns the "pointer" to a string.

! : Assign second top element to the pointer given by top element, points to less than 1st string/function, assign to the stack

# : Pick an element from a string given by a pointer at tos. Smaller pointers return elements from the stack.

( : Start pushing chars to pad.

) : Stop pushing chars to pad. If a valid integer is written before this symbol, evaluate that function.

^ : If inside parens, save pad to function given by tos (0 = stack) including " ^ " and clear pad, else evaluate function given by tos. If tos is greater than 32, evaluate that ascii character. Execution continues as long as functions with names greater than 0 are evaluated.

" : If inside parens, save to string given by tos not including " ^ ".

. : Write char at tos.

, : Wait for user input and push first char.

| : Wait for user input, and push are chars to string given by tos. If top of stack is 0 push chars to stack.

` : If tos is 0, print stack else print string at tos if it does not contain " ^ ".

[ : Begin storing filename.

] : Stop storing filename, and push file contents to pad.


Examples

Hello, World!

1$(Hello, World!
")`

Cat

1(,.1^1)

Quine

1(49.40.1`34.41.10.50.40.1`94.50.41.0")
2(49.40.1`34.41.10.50.40.1`94.50.41.0^2)

Self-interpreter

31(26(^)62.62.0 21&1-!0 94 53 50 32 0|29^)
29($0=27+^)
28(21&1-#26&+!26^)
27(21&1-$#$1+@!26&+!$ 94=29+^)
30($--94 43 42 53 50 61 48 36 48 27&17+!29^)
25(36 27&17+!0`31^)
21(22(22 0^)0 21&2-!24^)
24(21&2-$#$1+@!$3&+#$@22&+4+!0=24\-^)
23(93 21&2-#22&+3+$@\!1+$48\!1+$94\!1+$41\!1+$50\!1+$50\!1+94\!40 22&2+!91 22&3+!22^)
3&#0=10*21+^

See also

External resources