Skip to content

adittaBhattacharjee/StateZ

Repository files navigation

StateZ

StateZ is simple programming language that is writted in Python 3.10. It does not have complex functionalities and is just made for fun. Stars are very much appreciated. Everyone can also contribute to the repository, just make a pull request.

Usage

Create a new file called `hello_world.stz`. Then write:

print('Hello, World!')

Running a file

Run from interpreter directly

python interpreter.py *your_filename.stz

Run from StateZ shell

python runtime_shell.py
$state> run("*your_filename.stz")

Developers Guide

General

`python runtime_shell.py` opens the StateZ shell. Running `run("*your_filename.stz")` from the shell executes code from your file.

Variables

var cash = 100
var name = "Jake"
var new_cash = 100 + 10
var total_cash = cash + new_cash

print(cash)
print(name)
print(total_cash)

Output:

100
Jake
210

Conditions

if `condition` then `expression` elif `condtion` then `expression`

var cash = 100

if cash == 100 then var output=  "cash is 100" elif cash == 101 var output = "cash is "101" else var output("cash is something else")

print(output)

Output:

cash is 100

Loops

for i = 0 to 3 then
    print("hello")
end

Output:

hello
hello
hello

Functions

function call_great(prefix) -> prefix + " is great"
print(call_great("Aditya"))

Output

Aditya is great

Releases

No releases published

Packages

No packages published

Languages