GithubHelp home page GithubHelp logo

stream's Introduction

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.

stream's People

Contributors

isaac-leonard avatar

Stargazers

Favour (ThankGod)  Afenikhena avatar Tariq West avatar desp avatar Jack Hegarty avatar tawana-zw avatar LeLuCh B0й avatar Jeremy Carter avatar Sam Arun Raj Seeniraj avatar Toni Villena avatar  avatar Aris Husanu avatar Yunfei He avatar  avatar Clifford Fajardo  avatar  avatar David Alsh avatar

Watchers

 avatar

stream's Issues

Add Comments and documentation

I've been working on my own for all of this so far and have unfortunately been quite lacks with comments and documentation.
I intend to begin fixing this as I continue adding features however any help with older parts of the code would be quite welcome

Implement more sized number types

Currently only i32 and f32s are implemented along with limited u8 for characters.
This needs to be expanded however is not a priority at the moment as I am currently focussing on adding core features to the compiler.
Each of these will need a named type in the global environment, a variety of operations such as addition, multiplication and comparison to be implemented in both the type checking stage and in the compiler itself.
If you would like to help contribute this is a good place to start and will give a broad overview of how the whole compiler works.

Bring the LSP module up to date

Over the past few weeks I've been rapidly changing parts of the core compiler including key parts of the AST.
This unfortunately has brought the LSP module out of date to the point where it will not compile.
The required updates are minimal and should be made even easier now given the new utility methods on the AST.
This should be a relatively easy job although a lack of comments and documentation may make it harder than it should be.

Add autocomplete to the LSP module

I wasn't sure how to implement autocomplete effectively when I initially built the LSP module, I have some ideas now due to some of the modifications I've made to the ast however it is not a major priority until I begin writing code in the language.
If anyone would like to have a crack the help would be welcome

Add Linux support

I only have a Mac and have not implemented cross platform support yet.
Doing so should be relatively easy, all of the related code is located at the bottom of the compile.rs file.
All that needs to be done is detecting the current OS and giving LLVM the correct parameters for the detected operating system.
If anyone using linux would like to implement this it would be well appreciated

Implement the full set of mathematical operations for number types

Currently I've not focused on adding operations for some of the number types unless directly needed as I have been focused on more complicated parts of the compiler.
These operations however will be needed for actually writing programs eventually.
If anyone would like to help contribute this should be a relatively easy spot to begin.
Some of the symbols such as >> and << for bit shifting will need to be added to the parser.
Type checking and transformations will need to be added to the ast and the code in share.rs and the actual machine instructions will need to be implemented in the compiler.
Any help would be appreciated.

Add syntax highlighting to the LSP module

I'm blind and hence so far have ignored adding syntax highlighting to the LSP module as I have no way to effectively ensure its working as intended.
If anyone would like to implement this I would greatly appreciate it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.