StuLa

From Esolang
Jump to navigation Jump to search

StuLa (Stupid Language) is a programming language, made by User:CMinusMinus in 2019. It has variables, import options, input and output, 3 main variable types and functions.

Variables

Operator instructions:

Operator Function
X<i-1 X = 1
X<+i-1 X += 1
X<-i-1 X -= 1
X<*i-1 X *= 1
X</i-1 X /= 1
X<s-1 X = "1"
X<+s-1 X = X + "1"
X<v-A X = A
X<?-A X = input("A")
X<!-F X = F()
X<!-F & 1 & 2 X = F(1,2)

The definition of a variable is divided into three (for functions: four) parts.

Name, operator and value.

The operator is also divided into three parts.

"<", variable type (sometimes with an extra operator) and "-"

Lets create variable "x" with int 42.

x<i-42

Variable Name: "x"

operator: "<i-"

Value: "42"

You can insert variables wherever you want, just do "="+VARIABLE+"!" :

=X!
new_var<s-=X! (Equal to "new_var = x")

To return a value from a function into a variable, just do

VARIABLE<!-FUNCTION

like

returned_var<!-my_function & 42 & =my_value!

To delete a variable, do

destroy #VARIABLE

like

destroy #X

Input and Output

Input

To get an input, do

VAR<?-TEXT

like

name<?-Whats your name:=_!

(=_! is a built-in variable, which places a space)

Output

To output something, do

out:text/MY TEXT GOES HERE
out:line/MY TEXT GOES HERE (does a line break)

You can also place variables into a text:

x<i-42
out:text/The value of "x" is =x!.

Outputs:

The value of "x" is 42.

Functions

Defining

To define a function, do

func/<<FUNCNAME>>

like

func/<<my_func>>

Functions have to end with "<<>>"

Calling functions

You only can call functions, by defining them with a variable:

x<!-My_Function

To add arguments, do

x<!-My_Function & My_Argument_1 & =Some_var! & (...)

To get an argument in a function, do

[POSITION_OF_ARGUMENT]

like

[0]

while 0 is "My_Argument_1" and [1] would be the value of "Some_var".

To return a value from a function into a variable, do

..TEXT

like

..Hello, =username!.

So if you want to have a function, that gets an user input and saves it into "my_input", it would look like this:

func/<<getinput>>
i<?-TEXT:=_!
..=i!
<<>>
my_input<!-getinput
out:line/=my_input!

Importing functions

To import a function from another file, do

take FILENAME

like

take my_functions.txt

Now you are able to use these functions, like normal ones.

There are also some built-in functions, that allows you, to

  • Clear the terminal (StuTerm)
  • Write in different colors (StuTerm)

(WIP) You can import built-in functions, by typing

take your_function

like

take StuTerm

Examples

Hello, World!

out:line/Hello, World!

or

func/<<hw>>
..Hello, World!
<<>>
text<!-hw
out:line/=text!

Cat

i<?-Input Something:=_!
out:line/=i!

Run

To run the StuLa Interpreter, do

StuLa.py code.txt

If you changed some of this enviroment variables, you don´t need the ".py"

Links