View on GitHub

starsep-lang

My own programming language and its interpreter for Programming Languages and Paradigms course @ University of Warsaw

Language Description

starsep-lang is imperative language with functional features. Its grammar is based on Latte with my extensions.

Program Structure

Program is list of functions. The main function is executed.

Functions

Types

  void main() {
    list<int> emptyIntList = int[];
    list<int> append = 5 $ emptyIntList;
    list<int> join = append ++ append;
    list<char> stringList = "abc";
    list<int> listConstructor = int[1, 2, 3, 42 + 5];
  }
  void foo1() {}
  void foo2(int x) {}
  int foo3() { return 42; }
  int foo4(int x, int y) { return x + y; }
  void main() {
    fn<void> bar1 = foo1;
    fn<int -> void> bar2 = foo2;
    fn<int> bar3 = foo3;
    fn<int -> int -> int> bar4 = foo4;
  }

Variables

Operators

Comments

Control flow

 if BoolExpr1 {
    // instructions1
  } elif BoolExpr2 {
    // instructions2
  } else {
    // instructions3
  }
 while BoolExpr {
    // instructions
  }
 for Oper1; BoolExpr; Oper2 {
    // instructions
  }
  for varName in someList {
    // instructions
  }