GitXplorerGitXplorer
d

wolke-lang

public
6 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
c21dd6e8373460526a4d6648bbd3ea4db8f4f1da

Update README.md

ddrknzz committed 2 years ago
Unverified
d7edf08dd77c1672043d9e9b7403282a530f1c07

move examples

ddrknzz committed 2 years ago
Unverified
d6e1e065471213464dcc6092c2286ebeb62e26d0

refactor: move reference check to TC, return check to I

ddrknzz committed 3 years ago
Unverified
6ffceb6ffe27bbc4b2f753594eb4cfbcf0a40e1c

fix(TC): fix function argument redefinition

ddrknzz committed 3 years ago
Unverified
a7d39532b30d6f0b2f8a16db476dfd564ca40519

v1.0

ddrknzz committed 3 years ago
Unverified
eb7760869fbbdb0f11db63c3e7a8112e0940e51e

add tests

ddrknzz committed 3 years ago

README

The README file for this repository.

Wolke Language

wlk2


☁️ Description ☁️

Wolke is a statically typed, imperative language based on Python language.

There are 3 supported types: Int, String, Boolean.

Language makes such concepts as variable shadowing, static typing and static binding possible.


💡 Syntax 💡

Assignment

Int x = 5
Boolean y = False
String z = "a"

Print and assert

print(x)
print("Hello!")
assert(s == "local")
assert(x > 2)

Conditional statements

if x == 5:
    res = True
else:
    res = False

Loops and flow control statements

while x > 0:
    if x == 100:
        break
    if x == 200:
        continue
    x = x - 1

Functions

def increment(x | Int) -> Int:
    return x + 1

Pass variable by reference

def increment(y | Int&) -> Void:
    y = y + 1

Comments

# single line comment
/*
    multi
    line
    comment
*/

▶️ Usage ▶️

To run the interpreter, type these commands into terminal:

make
./interpreter <path_to_file>.wlk

📃 Implementation 📃

Wolke interpreter goes through 3 stages:

  1. Syntax checking

  2. Static type checking

  3. Program interpretation and evaluation


✨ Examples ✨

def multiply_str(s | String&, x | Int) -> Void:
    String tmp = s

    while x > 1:
        s = s + tmp
        x = x - 1


def main() -> Void:
    String s = "aa"

    multiply_str(s, 3)
    print(s)
    assert(s == "aaaaaa")

More examples of both corrent and incorrect programs are located here.


🧱 File structure 🧱

Directory Description
examples/bad programs resulting in an error
examples/good programs executing correctly
grammar/ files containing grammar of Wolke language
src/Gen source files generated by bnfc (docs)
src/ source files