Seeker

From Esolang
Jump to navigation Jump to search

Seeker is an esoteric programming language created by User:Saka (User:Galaxtone helped a little) that employs "seekers" and "blocks", pointers that can be accessed via the special functions.

Seeker is designed to be somewhat hard yet easy to program in.


The Basics

Instruction Description
|
Pointer ("seeker"), Used to jump to a section of code.
.
Instruction separator, Each instruction must be separated by this.
_
Blocker, Code execution stops upon reaching this.


Instructions

Instruction Description
!<name>
Declares variable called <name>.
@<name>:<name/number>
Sets the variable called <name> to value of the variable called <name> / the number of <number>.
@<name>:(<expression>
Sets the variable called <name> to the result of <expression>.
#<name>=<name/number>!<index>
If the variable called <name> has the value of the variable called <name> or the value of <number> then go to seeker at <index>, else, execute the next instruction.
&<name>
Print the value of the variable called <name> as an integer.
$<name>
Print the value of the variable called <name> as an ASCII character.

Note: "&" and "$" can both be used as functions for output and variables in expressions for input.

Special Instructions

Syntax Description
><index>
Go to seeker at <index>.
>?
Go to seeker at random index.
>}
Go to the next seeker.
><
Go to the previous seeker.
]<index>
Go to block at <index>.
]?
Go to block at random index.
]}
Go to the next block.
]<
Go to the previous block.


Input & Output

Input does not have any prompt (e.g. "> ")

Integer Input

Accepts any integer. Ignores non-numerical ASCII characters, numbers are written to output as typed and removed when deleting, halts execution until enter has been pressed and at least one numerical character has been typed.

ASCII Input

Accepts 1 ASCII character. Doesn't write to output, any character typed is converted from an ASCII character into an integer.

Output

Output can be in the form of integer(s) or ASCII character(s). Consecutive outputs are not printed on new lines. If one wants to print new lines, they must print the newline ASCII character (10).

Variable Operations

Whitespace and order of operations is ignored.

Name Syntax
<expression>
{<name> | <number>} <operation> {<name> | <number>} | <special>
<operation>
"-" | "+" | "*" | "/"
<special>
"&" | "$"

The "&" and "$" characters are used for integer and ASCII input, respectively as seen above in the "Instructions" section.

Arithmetic

Arithmetic operations must be written one by one. For example, if one wants to execute "x = 5+5+5", it must be

@x:(5+5.@x:(x+5

In other words, only one operation is allowed every time.

Examples

Simple Print

!x.@x:5.&x

Outputs "5"

Infinite counter (using seekers)

!x.@x:0.|.&x.@x:(x+1.>0

Truth-machine

!x.@x:&.#x=0!0.#x=1!1.|.$0._.|.$1.>1

Hello World!

Prints "Hello World!" with exclamation point:

!h.!e.!l.!o.!space.!w.!r.!d.!exc.@h:72.@e:101.@l:108.@o:111.@space:32.@w:119.@r:114.@d:100.@exc:33.$h.$e.$l.$l.$o.$space.$w.$o.$r.$l.$d.$exc._

Can also be done like this:

!chr.@chr:72.$chr.@chr:101.$chr.@chr:108.$chr.@chr:111.$chr.@chr:32.$chr.@chr:119.$chr.@chr:114.$chr.@chr:100.$chr.@chr:33.$chr._

Both output the same thing.

Infinite Fibonacci Sequence

Prints each number on it's own line:

!a.!b.!c.!n.@a:0.@b:1.@c:0.@n:10.|.@c:(a+b.@a:b.@b:c.&c.$n.>0