/stapl

Simple Type-Annotated Programming Language (WIP)

Primary LanguageC++MIT LicenseMIT

stapl

Simple Type-Annotated Programming Language

Inspired by & started as LLVM Kaleidoscope tutorial implementation here.

CMake

How to Build

Prerequisites:

  • C++ compiler with C++20 support
  • CMake 3.19+
  • Boost
  • LLVM
$ mkdir build
$ cd build
$ cmake -G 'Ninja' ..
$ ninja
$ ctest

The compiled binary is saved to build/src/staplc.

Example: fibonacci sequence

Note: syntax is subject to change as stapl is in early stage of development.

def fib(n: int): int
  if n <= 1 then
    n
  else
    fib(n - 1) + fib(n - 2)

extern put_int(x: int): void
extern scan_int(): int

def main(): void
  put_int(fib(scan_int()))

Roadmap

  • Efficient type checking
  • Support for statements: #1
  • Standard library
  • libc interop
  • More types (arrays, strings, structs, ...)
  • Compiler optimizations