kS

From Esolang
Jump to navigation Jump to search
KEA-stream
Designed by pf4
Appeared in 2022
Computational class Turing complete?
Major implementations python
File extension(s) .ks

KEA-stream is a language based on data streams. The language was inspired by the EV3-g where cables are used to connect action blocks.
In its original version, the KEA-stream is first compiled in KEA, an instruction language

Language overview

KEA-stream logo
Element Notation
variable $name
function name
push >
multi-stream splitter ,
string "string with spaces"

Examples

Hello, World!

This program prints out the words Hello World!

"Hello World!" > print

POW2

In this example 3 passes into the pow2 function, then is stored in the variable $result.

3 > pow2 > $result > print

Which can be coded in python with

result = pow2(3)
print(result)

Multi stream

This simple program uses multi stream with the and function which takes 2 inputs.

1, 0 >> and > $exit

XOR

Example of recreation of the XOR gate.

0, 1 >> $a, $b >> not, not >> $not_a, $not_b
$a, $not_b, $b, $not_a >>>> and, and >> or > print

Factorial

function that calculates the factorial of a number (see keyword below)

FUNC factorial $to
    1 > $exit
    $to > $i > LOOP
        $exit * $i > $exit
        $i - 1 > $i
        END
    $exit > RETURN

Keyword

All keywords are capitalized.

Loop

$turns > LOOP
    "hi" > print
    END

Conditions

$bool > IF
   "true" > print
    END

Function

functions can return a single value. RETURN acts like END
FUNC name $ar1$arg2
    $arg1 + $arg2 > RETURN

Funny situations

Calculation priority

The code is parsed word by word without applying priority for example

1 + 2 != 1 + 2 > print

it will display 3 because:
1 + 2 → 3
3 != 1 → 1
1 + 2 → 3

External resources