ospl 0.1.0

the (UNFINISHED!!!) OSPL programming language
Documentation

OSPL

A programming language with a Rust-based interpreter.

Building

cargo build

Running Programs

./target/debug/ospl run <file.ospl>
./target/debug/ospl run test.ospl

Alternative commands:

  • exe or r - run a file with statements
  • run-expr - run a file as an expression
  • run-stmt - run a file as a single statement

Syntax

Comments:

  • # for line comments
  • ***** multiline ***** for block comments

Variables:

def x = 10;
x = 20;  # reassignment

Functions:

def add = fn((a, b), c) {
    return a + b + c;
};

Control flow:

if condition {
    # code
} else if other {
    # code
} else {
    # code
};

select value {
    case (pattern) {
        # code
    }
    case (_) {
        # default case
    }
};

loop {
    # infinite loop
};

VS Code Extension

Install the .vsix file for syntax highlighting.

or compile it with:

cd vscode/ospl-vscode && npx vsce package | cat