The Amp programming language: a language designed for building high performance systems.

Overview

A language designed for building high performance systems.

Platform Support
x86_64-pc-windows
x86_64-unknown-linux ⚠️ untested
x86_64-unknown-darwin ⚠️ untested
aarch64-unknown-linux ⚠️ untested

Overview

⚠️ For legal reasons, I must warn you that the bold claims in this section aren't necessarily true, yet.

Also, Amp isn't really ready for serious use yet. It's not well tested and there's probably some undetected bugs in the compiler. With that in mind, have fun! :)

Amp focuses on:

  • Performance Amp's performance rivals that of C and C++.
  • Simplicity 🎨 Amp focuses on less, but more powerful features.
  • Speedy compilation 🏍️ Amp's simple design enables competitive compile times.
import "Std";

export func Main() {
    Std.Println("Hello, world!");
}

Contributing

Since Amp is vastly under-documented, feel free to create an issue if you have any questions about the project. If you are looking for something to contribute to the project, check out the open issues. Thanks for taking the time to contribute! 🎉

We follow the Contributor Covenant code of conduct (tl;dr: have some basic common sense and be respectful).

License

Amp is licensed under the MIT license.

Getting Started

You can install Amp from a prebuilt binary for your system or you can use Cargo to install it:

cargo install ampc
amp -V

Building an executable with Amp requires an external linker (as of right now, it's hardcoded as GCC, meaning GCC is required to build an executable):

amp test.amp -o test
./test # => Hello, world!
Comments
  • Prevent variable from being used before it's defined

    Prevent variable from being used before it's defined

    Currently, a variable can be used like this:

    func Print(buffer: []const u8);
    
    func Main() {
        var my_var: []const u8;
        Print(my_var);
    }
    

    This is undefined behavior and we want to avoid it. Throw an error when this occurs.

    fix typechecker 
    opened by pzipper 1
  • `while` loop statements

    `while` loop statements

    A standard while statement:

    var i = 0;
    while i < 10 {
        i = i + 1;
    }
    printf("%d", i); // => 10
    

    With an optional condition:

    while {
        Print("Going on forever...");
    }
    
    syntax/parser syntax/scanner typechecker codegen feat-language 
    opened by pzipper 0
  • Reference struct field

    Reference struct field

    struct MyStruct {
        member: i32,
    }
    
    func InitMember(member: ~mut i32) {
        *member = 0;
    }
    
    func Main() {
        var my_struct = MyStruct .{};
        InitMember(~mut my_struct.member);
    }
    
    fix typechecker codegen feat-language 
    opened by pzipper 0
  • Assign field of struct reference

    Assign field of struct reference

    This currently doesn't compile when it should:

    struct MyStruct {
        member: i32,
    }
    
    func MyStruct(self: ~mut MyStruct) {
        self.member = 42;
    }
    
    func Main() {
        var s = MyStruct .{ member = 0 };
        MyStruct(~mut s);
    }
    
    fix typechecker codegen feat-language 
    opened by pzipper 0
  • Link multiple Amp modules together through command line

    Link multiple Amp modules together through command line

    It would be useful for the command line to allow multiple Amp files to be linked together, like so:

    // test1.amp
    func Print(str: []const u8);
    func Test() {
        Print("Hello, world!");
    }
    
    // test2.amp
    func Test();
    
    func Main() {
        Test();
    }
    

    And then link them together with the command line:

    amp test1.amp test2.amp -o test
    ./test
    
    feat-cli cli 
    opened by pzipper 0
  • Dereference assignments

    Dereference assignments

    func printf(str: ~mut u8) -> i32;
    
    func Main() {
        var my_str: ~mut u8 = "Hello, world!";
        *my_str = 0x66;
        printf(my_str); // => Bello, world!
    }
    
    typechecker codegen 
    opened by pzipper 0
  • Function calls as values

    Function calls as values

    Allow function calls as values:

    func GetStr() -> []const u8 {
        return "Hello, world!";
    }
    
    func Print(str: []const u8);
    
    func Main() {
        Print(GetStr());
    }
    
    typechecker codegen 
    opened by pzipper 0
  • Implement returning big values

    Implement returning big values

    Big values, such as slices, do not fit in registers and must be implemented differently than primitive values such as integers.

    func GetStr() -> []const u8 {
        return "Hello, world!";
    }
    

    This should follow the C ABI for returning struct values.

    codegen 
    opened by pzipper 0
  • Implement slice types

    Implement slice types

    Implement a slice type for strings.

    The layout for [u8] should be the same as the following C code:

    typedef struct {
        char *ptr;
        size_t len;
    } U8Slice;
    

    That is, the pointer value followed by the number of items in the slice.

    feat-cli syntax/parser syntax/scanner typechecker codegen feat-language 
    opened by pzipper 0
  • Output diagnostic rather than unwrapping file contents

    Output diagnostic rather than unwrapping file contents

    Currently, the compile reads the path of the input file to the command line and panics if the file can't be read. This behavior should instead be replaced with displaying a diagnostic message.

    fix feat-cli cli 
    opened by pzipper 0
  • Integer values & types

    Integer values & types

    Implement integer values and types.

    Currently, we need i32 types and decimal integers. Already implemented in the scanner, the rest should be relatively simple.

    syntax/parser typechecker codegen feat-language 
    opened by pzipper 0
  • Labeled loops

    Labeled loops

    Description

    Loops should be possible to label, so they can be broken or continued from an inner loop.

    I am unsure of the best syntax for this, we can go for the classic:

    label: while true {}
    

    Or we can go for a different syntax:

    while:label true {}
    

    Use Cases

    var x = 0;
    outer: while x < 100 {
        var y = 0;
        while y < 100 {
            if my_condition {
                break outer;
            }
            y = y + 1;
        }
        x = x + 1;
    }
    
    syntax/parser typechecker codegen feat-language 
    opened by pzipper 0
  • `import` statements

    `import` statements

    Syntax

    import "Std";
    

    The compiler searches the following paths for the module with the given name, in order:

    • Std
    • Std.amp
    • Std/Main.amp

    Local modules can be imported using the following syntax:

    import "./MyModule";
    

    The compiler searches the following paths for the module with the given name, in order:

    • ./MyModule
    • ./MyModule.amp
    • ./MyModule/Main.amp

    Command Line

    This would also introduce the -I compiler flag, which would add a path to search for modules in:

    amp test.amp -I runtime
    

    Given the above example, the compiler would search the following paths for the Std module (in order):

    • runtime/Std
    • runtime/Std.amp
    • runtime/Std/Main.amp
    feat-cli syntax/parser syntax/scanner typechecker codegen feat-language 
    opened by pzipper 0
Releases(v0.2.0-alpha)
Owner
The Amp Programming Language
A programming language designed for building high performance systems.
The Amp Programming Language
Rust API Server: A versatile template for building RESTful interfaces, designed for simplicity in setup and configuration using the Rust programming language.

RUST API SERVER Introduction Welcome to the Rust API Server! This server provides a simple REST interface for your applications. This README will guid

Harry Nguyen 3 Feb 25, 2024
A high-performance Rust library designed to seamlessly integrate with the Discord API.

Rucord - Rust Library for Discord API Interactions Note: This library is currently under development and is not yet recommended for production use. Ov

Coders' Collab 4 Feb 26, 2023
Local-first high performance codebase index engine designed for AI

CodeIndex CodeIndex is a local-first high performance codebase index engine designed for AI. It helps your LLM understand the structure and semantics

Jipiti AI 9 Aug 30, 2023
A lightweight and high-performance order-book designed to process level 2 and trades data. Available in Rust and Python

ninjabook A lightweight and high-performance order-book implemented in Rust, designed to process level 2 and trades data. Available in Python and Rust

Ninja Quant 134 Jul 22, 2024
Open-source Rust framework for building event-driven live-trading & backtesting systems

Barter Barter is an open-source Rust framework for building event-driven live-trading & backtesting systems. Algorithmic trade with the peace of mind

Barter 157 Feb 18, 2023
F-Fetch targets low systems. Written in Rust. It's very simple, designed so you can pick it up and replace it.

F-Fetch F-Fetch targets low systems. Written in Rust. It's very simple, designed so you can pick it up and replace it. First Look ~/.config/ffetch/con

cd 3 Jul 10, 2023
Stream-based visual programming language for systems observability

Stream-based visual programming language for systems observability. Metalens allows to build observability programs in a reactive and visual way. On L

Nikita Baksalyar 53 Dec 23, 2022
🛠️ An experimental functional systems programming language, written in Rust and powered by LLVM as a backend.

An experimental functional systems programming language, written in Rust, and powered by LLVM as a backend. ?? Goal: The intent is to create a program

codex 3 Nov 15, 2023
Designed as successor to Pretty-Good-Video for improved codec structure, API design & performance

Pretty Fast Video Minimal video codec designed as a successor to Pretty Good Video Goals are to improve: Quality API design Codec structure (Hopefully

Hazel Stagner 36 Jun 5, 2023
An Interpreter for Brainfuck programming language implemented in the Rust programming language with zero dependencies.

Brainfuck Hello, Visitor! Hey there, welcome to my project showcase website! It's great to have you here. I hope you're ready to check out some awesom

Syed Vilayat Ali Rizvi 7 Mar 31, 2023
Assignments of Stanford CS110L-2020spr: Safety in Systems Programming

CS110L Spring 2020: Safety in Systems Programming 课程简介 CS110L将带领我们学习 Rust ,这是一门注重 安全、性能、工程 的语言。 Why Rust? 我的浅显理解是:Rust 被设计出来旨在解决目前系统级编程的困难,其特征 “安全、性能、

Shaofeng 6 Dec 28, 2022
Holo is a suite of routing protocols designed to support high-scale and automation-driven networks.

Holo is a suite of routing protocols designed to support high-scale and automation-driven networks. For a description of what a routing protocol is, p

Renato Westphal 42 Apr 16, 2023
ratlab is a programming platform designed loosely for hobbyist and masochist to analyse and design stuff and things that transform our world?

ratlab A programming language developed by Quinn Horton and Jay Hunter. ratlab is a programming platform designed loosely for hobbyists and masochists

Jay 10 Sep 4, 2023
High-performance and normalised trading interface capable of executing across many financial venues

High-performance and normalised trading interface capable of executing across many financial venues. Also provides a feature rich simulated exchange to assist with backtesting and dry-trading.

Barter 7 Dec 28, 2022
High-performance asynchronous computation framework for system simulation

Asynchronix A high-performance asynchronous computation framework for system simulation. What is this? Warning: this page is at the moment mostly addr

Asynchronics 7 Dec 7, 2022
A modern high-performance open source file analysis library for automating localization tasks

?? Filecount Filecount is a modern high-performance open source file analysis library for automating localization tasks. It enables you to add file an

Babblebase 4 Nov 11, 2022
High-performance, low-level framework for composing flexible web integrations

High-performance, low-level framework for composing flexible web integrations. Used mainly as a dependency of `barter-rs` project

Barter 8 Dec 28, 2022
High performance wlroots screen recording, featuring hardware encoding

wl-screenrec High performance wlroots based screen recorder. Uses dma-buf transfers to get surface, and uses the GPU to do both the pixel format conve

Russell Greene 32 Jan 21, 2023
A high-performance WebSocket integration library for streaming public market data. Used as a key dependency of the `barter-rs` project.

Barter-Data A high-performance WebSocket integration library for streaming public market data from leading cryptocurrency exchanges - batteries includ

Barter 23 Feb 3, 2023