Skip to content

A compiler and toolchain for the Stream programming language

Notifications You must be signed in to change notification settings

Isaac-Leonard/Stream

Repository files navigation

A compiler for The Stream programming language

Notes

This project initially began as an implementation of the borrow-script language found at https://github.com/alshdavid/BorrowScript/ however I have diverged from the current specifications and plan to likely go in a slightly different direction while still following the same general idea of a memory safe, thread safe, compilable language with similar semantics to typescript and rust while simplifying and learning from the mistakes of both. Check the road map section for what is likely to be implemented next.

Features

  • JS / TS style syntax.
  • Int, Float, Boolean and Null Primitives.
  • Structs, arrays and String Objects.
  • Objects are pass by reference / pointer.
  • Primitives are pass by value.
  • Tagged union types although they’re not very usable at the moment.
  • Basic generics although not for functions yet.
  • while Loops and if else expressions.
  • named and anonymous functions, aka lambdas although they cannot currently capture variables.
  • LSP support though its currently broken.

Running the compiler

After installing dependencies run with

$ cargo run -- example-compile.srm

then run the produced binary

./testing

Road map

The following is a list of features I intend to implement in the short term (next three months) however my time is limited and some features may require others to be implemented first or may require major rewrites in the compiler internals so this is currently still unreliable. In order of likely implementation:

  • Full generics support in the compiler.
  • Proper type narrowing on unions.
  • Improved error checking and reporting.
  • Proper closures
  • More extensive options for controlling compilation including:
    • Specifying an output binary name,
    • multiple levels of optimization,
    • using precompiled binaries when linking allowing for full interoperability with existing compiled binaries (Note that Stubs would still have to be written to tell the compiler what they should be called like such like is currently done with puts and getchar),
    • and better debugging.
  • Automatic memory management.
  • Publish code to cargo and split it up into modules.
  • Formatter.

In the long term (next 6 months to a year) I intend to make the compiler completely bootstrappable and start writing some projects using it as well as working on multithreading support.

About

A compiler and toolchain for the Stream programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages