Coder Social home page Coder Social logo

vimhax / ares Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 76 KB

What would Rust with the simplicity of TypeScript look like? This is my take.

License: GNU General Public License v3.0

Rust 100.00%
rust compiler llvm statically-typed high-level-language programming-language

ares's Introduction

Ares v0.1.0

This is a small, compiled (with LLVM), statically typed, high-level programming language made, in Rust, inspired by my 2 most favorite languages (as of writing this) Rust and TypeScript. (Mostly inspired by Rust at this point in development) It combines the simplicity of TypeScript with the ergonomics of a language built from the ground up to be a statically typed language, Rust.

An Example Program

fn fib(term: Int) -> Int {
	if term == 0 { 0 }
	else if term == 1 { 1 }
	else { fib(term - 1) + fib(term - 2) }
}

fn main() {
	let count = 0;
	loop {
		if count == 10 {
			return;
		}
		print(fib(count));
		count = count + 1;
	}
}

Goals

Keep the language as simple as possible while also not being limiting. High performance with the productivity of a high level language like JavaScript. Make the syntax easy to read and understand. (The language is a far cry from all of these goals though as of right now.)

Features

  • Variables and (very) primitive data types. (Int, Float, Boolean and String so far)
  • Very basic control flow, if statements and loops.
  • Functions with parameters and return types.
  • Static typing with type inference.
  • Rust style interchangeable expressions and statements. (You can put statements inside expressions and vice versa)
  • Dead code detection.
  • Rust style implicit returns. (The last expression in a function body will get implicitly returned)
  • Rust style error messages. (Most of the time they are clunky though)
  • And that's really about it for now...

Road map

  • Release a, probably working, version of Ares to GitHub.

  • Unit testing.

  • Language server (LSP) + Visual Studio Code extension.

  • Implement the rest of the built-in operators, data types, statements etc.

  • structs and impls (Rust style)

  • enums which can carry extra data (Rust style)

    Yeah that's enough for now.

Installation

You need to have Rust and Git installed and any prerequisites required to compile the llvm-sys crate.

Ares has only been tested on Linux, Arch Linux x86_64, your experience may vary. If you want compile code for a different OS you may need to change the target triple hard coded in compiler/src/main.rs for your system.

Run the command below to clone this repository locally.

$ git clone https://github.com/VimHax/Ares

Afterwards change your directory into the compiler workspace, ./Ares/compiler, and run;

$ cargo run main.ares ./main.o ./main --run

The first parameter is the path to the input Ares source code. The second parameter is the the path to store the object code. The final parameter is to store the linked executable. The --run flag makes the compiler execute the program for you after compilation. Use --help to view other options.

ares's People

Contributors

vimhax avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.