Skip to content

Latest commit

 

History

History
65 lines (59 loc) · 893 Bytes

README.md

File metadata and controls

65 lines (59 loc) · 893 Bytes

SPL

Simple programming language (WIP).

Build instructions

Prerequisite

You need to have the following installed on your system:

  • CMake 3.25+.
  • A C++ Compiler.
  • Git
  • Flex
  • Bison

Cloning the repo

git clone https://github.com/mrunix00/SPL.git

Build

cd SPL/
make -j`nproc`
./build/SPL

Syntax

Variable declaration

define x : int = 42;
define y = 42;

Arrays

define arr : int[] = [1, 2, 3, 4, 5];
define element = arr[0];

Function declaration

define add : function(x : int, y : int) -> int = {
    return x + y;
};

Conditions

if x == 42 {
    // do something
} else {
    // do something else
};

Loops

While loops

while x < 42 {
    // do something
};

For loops

for define i = 0; i < 20; i++ {
    // do something
};