Git Product home page Git Product logo

liam's Introduction

logo
A Data-Oriented Programming Language for modern developers.


The Liam Programming Language

Liam is a strongly typed compiled language intended for performance comparable to C++ but less pain along the way. Liam generates and outputs c++ which is then compiled to a final binary.

Stack allocated linked list example:

struct NodeAllocator {
    buffer: [100]Node,
    used: i64
}

fn make_node(allocator: ^NodeAllocator, value: i64) ^Node {
    let node : ^Node = &allocator.buffer[allocator.used];
    allocator.used = allocator.used + 1;

    *node = new Node{
        value: value,
        next: null
    };

    return node;
}

struct Node {
    value: i64,
    next: ^Node
}

struct LinkedList {
    head: ^Node,
    size: i64
}

fn make_linked_list() LinkedList {
    return new LinkedList {
        head: null,
        size: 0
    };
}

fn push(list: ^LinkedList, allocator: ^NodeAllocator, value: i64) void {
    let new_node := make_node(allocator, value);
    if list.head == null {
        list.head = new_node;
        return;
    }

    let current_node := list.head;

    // there are no while loops yet so having a dummy 
    // varaible here is needed
    for let dummy := 0; current_node.next != null; current_node = current_node.next; {}

    current_node.next = new_node;
}

fn main() void {
    let allocator : NodeAllocator = zero;
    let list := make_linked_list();
    push(&list, &allocator, 10);
    push(&list, &allocator, 20);
    push(&list, &allocator, 30);

    for let node := list.head; node != null; node = node.next; {

    }
}

Features and possbile future ones

Added

  • basic structs (no generics, or member functions)
  • basic functions (no generics)
  • size specific builting data types (u8, u16, u32, u64)
  • stack allocated non-dynamic arrays of arbitrarty types
  • multiple files using import
  • non-polluting import statements with namespace identifiers
  • out-of-order top level definitions
  • slice types
  • slicing syntax for arrays and slices
  • for and while loops

Maybe [how easy/how useful for the current state/will not need to be redone/future work not harder]

  • type safe continue, return and break [4/4/3/6] 19
  • generic arguments for structs [2/5/4/2] 13
  • generics arguments for functions [3/7/6/4] 20
  • tagged union style enums (like rust enums) [2/3/6/6] 17
  • enum pattern mathcing with a match keyword [3/2/5/6] 16
  • iterators (non concreate idea no how these will work yet) [2/3/3/5] 13
    • for static arrays
    • a range given
    • user defined types
  • number types coercing [3/10/4/4] 21
  • const and var types [2/1/3/3] 9
  • some error handling solution (zig, rust and go are all nice) [2/2/5/7] 16
  • better stdlib [6/5/1/7] 19
    • dynamic array
    • String type
    • I/O
    • memory management
  • bounds checking for container types only in debug mode with debug mode option [8/1/8/9] 26
  • member functions for structs [4/2/5/5] 18
  • global variables (const or maybe not) [5/1/8/7] 21
  • defer keyword [1/1/4/7] 13
  • some kind of optional types (either with tagged unions or builtin like zig) [2/3/7/6] 18
  • calling into C/C++ from liam [5/4/6/7] 22
  • inline custom struct types [1/2/7/2] 12

Documentation

Some helpful documentation for getting started learning Liam.

liam's People

Contributors

jackdelahunt avatar jackburnergithub avatar

Stargazers

 avatar Ramakrishna Pattnaik avatar  avatar Andrew Johnson avatar ypcpy avatar  avatar Dimitri Saridakis avatar Mike Tarpey avatar Praveen avatar  avatar Saptak Bhoumik avatar Adrian Hebel avatar

Watchers

James Cloos avatar  avatar

Forkers

mmhe

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.