Concrete is a simple programming language specifically crafted for creating highly scalable systems that are reliable, efficient, and easy to maintain.

Related tags

Utilities concrete
Overview

The Concrete Programming Language

Telegram Chat license

Most ideas come from previous ideas - Alan C. Kay, The Early History Of Smalltalk

In the realm of low-level programming, language safety, performance and simplicity are paramount features. We are confident that these attributes can be achieved in system programming languages without substantially sacrificing expressiveness. Concrete achieves this balance, offering a programming language that is fast, simple and safe without having a garbage collector, lifetimes and a complex borrow checker. Additionally, it features a default pluggable runtime, enabling the development of highly scalable systems that are not only reliable and efficient but also straightforward to maintain.

Writing good code should be easy. The language must be simple enough to fit in a single person’s head. Programs are about transforming data into other forms of data. Code is about expressing algorithms, not the type system. We aim to develop a simpler version of Rust that includes an optional default runtime featuring green threads and a preemptive scheduler, similar to those found in Go and Erlang.

Installing from Source

Building is as simple as cloning this repository and running the make build command, provided you have all the needed dependencies.

Dependencies

Make sure you have installed the dependencies:

  • git
  • Rust
  • LLVM 18 with MLIR enabled
  • libgit2

If building LLVM from source, you'll need additional tools:

  • g++, clang++, or MSVC with versions listed on LLVM's documentation
  • ninja, or GNU make 3.81 or later (Ninja is recommended, especially on Windows)
  • cmake 3.13.4 or later
  • libstdc++-static may be required on some Linux distributions such as Fedora and Ubuntu

Setup the following env vars:

# For Debian/Ubuntu using the repository, the path will be /usr/lib/llvm-18
export MLIR_SYS_180_PREFIX=/usr/lib/llvm-18
export LLVM_SYS_180_PREFIX=/usr/lib/llvm-18
export TABLEGEN_180_PREFIX=/usr/lib/llvm-18

If you installed llvm with brew, source the env-macos.sh script to set up the needed env vars:

source scripts/env-macos.sh

Table of Contents

Design

Rust similarities and differences

Concrete take many features from Rust like:

  • Enum, structs instead of classes
  • Ad-hoc polymorphism via traits
  • Parametric polymorphism via generics
  • Expressions and statements rather than only expressions as in many functional languages
  • Built-in dependency manager
  • Built-in linter and formatter
  • Built-in testing tooling
  • Good compilation error messages
  • Inmutability by default, optional mutability

But we want to take a different path with respect to:

  • Linear type system rather than affine type system
  • No lifetimes
  • Simpler borrow checker
  • Concurrency model. We provide a default runtime with green threads. There is no support for low-level primitives like atomics, mutex and OS threads.
  • There is no Sync and Send traits. This implies that mutability can only happen inside the same process.
  • No relationsihp between modules and files
  • No circular dependencies in modules
  • No macros
  • At the beginning we won't support local type inference at function level. We might add it in the future.
  • Financials decimal type and bigint type as part of the standard library
  • Safe FFI
  • Perfect replayability to be able to easily reproduce Heisenbugs
  • We want to try to have bit-for-bit deterministic/reproducible builds from the beginning. This will be difficult to have but we will do our best.

Core features

  • C/Go/Rust-inspired, context-free small grammar, syntax: if, for, function calls, modules, pattern matching
  • Safe. Linear types that allow memory and other resources to be managed safely and without runtime overhead
  • Small core. The entire language specification should be possible to be memorized
  • Performant as C/C++ or Rust
  • Pluggable concurrency runtime with a preemptive scheduler, green threads and copy only message passing
  • Profiling and tracing are integral, first-class features. While code is read more often than it's written, it is executed even more frequently than it's read
  • There ought to be one way to write something. Striving for orthogonality
  • Explicit over implicit
  • Cross compilation as first class citizen
  • Easy C, C++ and Rust FFI
  • Easily embeddable
  • Capability based security to defend against supply chain attacks

Second level features

  • Type inference only within blocks, not in function signatures
  • Algebraic Data Types
  • Traits and Generics
  • REPL for connecting to running services and for quick iteration
  • Compile to MLIR, WASM and generate C code
  • Financials decimal type and bigint type as part of the standard library
  • Implemented in Rust

Anti-features

  • No hidden memory allocation
  • No garbage collection or destructors
  • No hidden control flow or implicit function call
  • No preprocessor, no macros
  • No global state
  • No exceptions
  • No type inference, type information flows in one direction
  • No implicit type conversions
  • No reflection
  • No function overloading (except through typeclasses, where it is bounded)
  • No uninitialized variables
  • No pre/post increment/decrement (x++ in C)
  • No variable shadowing
  • No Java-style @Annotations
  • No undefined behavior
  • No marker traits like Send, Sync for concurrency. The runtime will take care of that.

Syntax

mod Fibonacci {
    fn main() -> i64 {
        return fib(10);
    }

    pub fn fib(n: u64) -> u64 {
        if n < 2 {
            return n;
        }

        return fib(n - 1) + fib(n - 2);
    }
}
mod StructExample {
    struct Foo {
        bar: i32,
        baz: i64,
    }

    fn main() -> i32 {
        let mut foo: Foo = Foo {
            bar: 2,
            baz: 3,
        };

        foo.bar = foo.bar * 2;

        return get_foo_field_by_borrow(&foo) + foo.bar;
    }

    fn get_foo_field_by_borrow(x: &Foo) -> i32 {
        return x.bar;
    }
}
mod Option {
    pub enum Option<T> {
        None,
        Some(T),
    }

    pub fn map<A, B>(opt: Option<A>, f: A -> B) -> Option<B> {
        match opt {
            None -> None,
            Some(x) -> Some(f(x)),
        }
    }
}

mod UsesOption {
    import MyOption.{Option, map};

    pub fn headOfVectorPlus1(x: [u8]) -> Option<u8> {
        // head returns an option
        x.head().map((x: u8) -> x + 1)
    }

}

Inspiration

The design was very heavily influenced by all these programming languages:

We want to thanks everyone of them. We also took core ideas, specs and features from these languages:

Roadmap

For a full roadmap check the project.

Meaning:

  • βœ”οΈ = implemented
  • πŸ—οΈ = work in progress
  • ❌ = work not started yet
  • πŸ€” = to be defined

Features:

  • if/else βœ”οΈ
  • while βœ”οΈ
  • modules βœ”οΈ
  • imports βœ”οΈ
  • floats βœ”οΈ
  • borrowing βœ”οΈ
  • structs βœ”οΈ
  • casts βœ”οΈ
  • arrays πŸ—οΈ
  • iterators ❌
  • for πŸ—οΈ
  • match ❌
  • option ❌
  • enums ❌
  • impl ❌
  • linear type checker πŸ—οΈ
  • borrow checker ❌
  • generics ❌
  • traits ❌
  • unsafe ❌
  • box ❌
  • rc (for cyclical data structures like graphs) ❌
  • ffi ❌
  • operating system threads with move only semantics ❌
  • rayon-like ❌

Post-runtime features:

  • runtime with preemptive green threads ❌
  • erlang like profiling ❌
  • erlang like tracing ❌
  • erlang like observer ❌
  • standard library ❌
    • gleam otp like library patterns ❌
  • http server ❌
  • json ❌
  • sql server ❌
  • serde replacement ❌
  • rustler like binding generator to call rust code ❌
  • embeddable concrete (no allocator, first-class support for no standard library, etc) ❌
  • capabilities πŸ€”

Benchmarking

There are some simple program benchmarks against Rust.

You can run them using the following make target:

make bench
Comments
  • Parse floats, parse chars and strings with escape codes

    Parse floats, parse chars and strings with escape codes

     mod Simple {
        fn main() -> i64 {
            let a: f32 = my_f32(2.0, 4.0);
            let b: f64 = my_f64(2.0, 4.0);
            return 1;
        }
    
        fn my_f32(x: f32, y: f32) -> f32 {
            let literal: f32 = 2.0;
            let literal2: f32 = 2.;
            let literal3: f32 = .1;
            return x + y + literal2 + literal3;
        }
    
        fn my_f64(x: f64, y: f64) -> f64 {
            let literal: f64 = 2.0;
            let literal2: f64 = 2.;
            let literal3: f64 = .1;
            return x + y + literal2 + literal3;
        }
    }
    
     mod Simple {
        fn main() -> i64 {
            let a: char = hello_chars('\t');
            return 1;
        }
    
        fn hello_chars(a: char) -> char {
            let x: char = 'b';
            let newline: char = '\n';
    
            return x + newline + a;
        }
    }
    
    opened by edg-l 4
  • testcases in concrete_driver examples includes check phase for linearity check coverage

    testcases in concrete_driver examples includes check phase for linearity check coverage

    It can be checked in codecov we are now covering linearity_check.rs source file.

    Linearity check algorithm can be aknowledged as completed when fn check_var_in_expr coverage of match statement is fully covered. It is expected to cover not with examples .con file, but manually building the conditions for coverage, as the current status of the parser is possible not to satisfy all conditions from a parsed source code.

    opened by kenarab 3
  • Add output flags to CLI

    Add output flags to CLI

    This PR adds flags for writing either ast, ir, llvm, ast, object, mlir to a file.

    Code Example:

    mod Example {
        fn main() -> i32 {
            return 5 + 5;
        }
    }
    
    

    AST Example:

    [
        Program {
            file_path: Some(
                "examples/simple.con",
            ),
            modules: [
                Module {
                    doc_string: None,
                    imports: [],
                    name: Ident {
                        name: "Example",
                        span: Span {
                            from: 4,
                            to: 11,
                        },
                    },
                    contents: [
                        Function(
                            FunctionDef {
                                decl: FunctionDecl {
                                    doc_string: None,
                                    generic_params: [],
                                    name: Ident {
                                        name: "main",
                                        span: Span {
                                            from: 21,
                                            to: 25,
                                        },
                                    },
                                    params: [],
                                    ret_type: Some(
                                        Simple {
                                            name: Ident {
                                                name: "i32",
                                                span: Span {
                                                    from: 31,
                                                    to: 34,
                                                },
                                            },
                                            qualifiers: [],
                                            span: Span {
                                                from: 31,
                                                to: 34,
                                            },
                                        },
                                    ),
                                    is_extern: false,
                                    is_pub: false,
                                    span: Span {
                                        from: 18,
                                        to: 34,
                                    },
                                },
                                body: [
                                    Return(
                                        ReturnStmt {
                                            value: Some(
                                                BinaryOp(
                                                    Value(
                                                        ConstInt(
                                                            5,
                                                            Span {
                                                                from: 52,
                                                                to: 53,
                                                            },
                                                        ),
                                                        Span {
                                                            from: 52,
                                                            to: 53,
                                                        },
                                                    ),
                                                    Arith(
                                                        Add,
                                                    ),
                                                    Value(
                                                        ConstInt(
                                                            5,
                                                            Span {
                                                                from: 56,
                                                                to: 57,
                                                            },
                                                        ),
                                                        Span {
                                                            from: 56,
                                                            to: 57,
                                                        },
                                                    ),
                                                ),
                                            ),
                                            span: Span {
                                                from: 45,
                                                to: 57,
                                            },
                                        },
                                    ),
                                ],
                                span: Span {
                                    from: 18,
                                    to: 64,
                                },
                            },
                        ),
                    ],
                    span: Span {
                        from: 0,
                        to: 66,
                    },
                },
            ],
        },
    ]
    

    IR Example:

    ProgramBody {
        top_level_module_names: {
            "Example": DefId {
                program_id: 0,
                id: 1,
            },
        },
        top_level_modules: [
            DefId {
                program_id: 0,
                id: 1,
            },
        ],
        modules: {
            DefId {
                program_id: 0,
                id: 1,
            }: ModuleBody {
                id: DefId {
                    program_id: 0,
                    id: 1,
                },
                parent_ids: [],
                symbols: SymbolTable {
                    symbols: {},
                    modules: {},
                    functions: {
                        "main": DefId {
                            program_id: 0,
                            id: 2,
                        },
                    },
                    constants: {},
                    structs: {},
                    types: {},
                },
                functions: {
                    DefId {
                        program_id: 0,
                        id: 2,
                    },
                },
                structs: {},
                types: {},
                constants: {},
                modules: {},
                imports: {},
            },
        },
        functions: {
            DefId {
                program_id: 0,
                id: 2,
            }: FnBody {
                id: DefId {
                    program_id: 0,
                    id: 2,
                },
                name: "main",
                is_extern: false,
                basic_blocks: [
                    BasicBlock {
                        statements: [
                            Statement {
                                span: None,
                                kind: StorageLive(
                                    1,
                                ),
                            },
                            Statement {
                                span: None,
                                kind: Assign(
                                    Place {
                                        local: 1,
                                        projection: [],
                                    },
                                    Use(
                                        Const(
                                            ConstData {
                                                ty: Ty {
                                                    span: Some(
                                                        Span {
                                                            from: 31,
                                                            to: 34,
                                                        },
                                                    ),
                                                    kind: Int(
                                                        I32,
                                                    ),
                                                },
                                                data: Value(
                                                    Leaf(
                                                        I32(
                                                            5,
                                                        ),
                                                    ),
                                                ),
                                            },
                                        ),
                                    ),
                                ),
                            },
                            Statement {
                                span: None,
                                kind: StorageLive(
                                    2,
                                ),
                            },
                            Statement {
                                span: None,
                                kind: Assign(
                                    Place {
                                        local: 2,
                                        projection: [],
                                    },
                                    Use(
                                        Const(
                                            ConstData {
                                                ty: Ty {
                                                    span: Some(
                                                        Span {
                                                            from: 31,
                                                            to: 34,
                                                        },
                                                    ),
                                                    kind: Int(
                                                        I32,
                                                    ),
                                                },
                                                data: Value(
                                                    Leaf(
                                                        I32(
                                                            5,
                                                        ),
                                                    ),
                                                ),
                                            },
                                        ),
                                    ),
                                ),
                            },
                            Statement {
                                span: None,
                                kind: Assign(
                                    Place {
                                        local: 0,
                                        projection: [],
                                    },
                                    BinaryOp(
                                        Add,
                                        (
                                            Place(
                                                Place {
                                                    local: 1,
                                                    projection: [],
                                                },
                                            ),
                                            Place(
                                                Place {
                                                    local: 2,
                                                    projection: [],
                                                },
                                            ),
                                        ),
                                    ),
                                ),
                            },
                        ],
                        terminator: Terminator {
                            span: None,
                            kind: Return,
                        },
                    },
                    BasicBlock {
                        statements: [],
                        terminator: Terminator {
                            span: None,
                            kind: Return,
                        },
                    },
                ],
                locals: [
                    Local {
                        span: None,
                        debug_name: None,
                        ty: Ty {
                            span: Some(
                                Span {
                                    from: 31,
                                    to: 34,
                                },
                            ),
                            kind: Int(
                                I32,
                            ),
                        },
                        kind: ReturnPointer,
                    },
                    Local {
                        span: None,
                        debug_name: None,
                        ty: Ty {
                            span: Some(
                                Span {
                                    from: 31,
                                    to: 34,
                                },
                            ),
                            kind: Int(
                                I32,
                            ),
                        },
                        kind: Temp,
                    },
                    Local {
                        span: None,
                        debug_name: None,
                        ty: Ty {
                            span: Some(
                                Span {
                                    from: 31,
                                    to: 34,
                                },
                            ),
                            kind: Int(
                                I32,
                            ),
                        },
                        kind: Temp,
                    },
                ],
            },
        },
        structs: {},
        function_signatures: {
            DefId {
                program_id: 0,
                id: 2,
            }: (
                [],
                Ty {
                    span: Some(
                        Span {
                            from: 31,
                            to: 34,
                        },
                    ),
                    kind: Int(
                        I32,
                    ),
                },
            ),
        },
        file_paths: {
            0: "examples/simple.con",
        },
    }
    
    opened by JulianGCalderon 3
  • Installation in Macbook pro M2

    Installation in Macbook pro M2

    Hi guys!

    I'm using a macbook pro M2 (AArch64)

    I followed the instructions for installing concrete. I came quite far, but had a problem when concrete tries to link the binary

      Compiling tracing-subscriber v0.3.18
       Compiling concrete_parser v0.1.0 (/Users/kenarab/git/concrete/crates/concrete_parser)
       Compiling melior-macro v0.10.2
       Compiling melior v0.16.2
       Compiling concrete_driver v0.1.0 (/Users/kenarab/git/concrete/crates/concrete_driver)
       Compiling concrete v0.1.0 (/Users/kenarab/git/concrete/crates/concrete)
        Building [=======================> ] 270/271: concrete(bin)       
    

    And the errors seems to be with a non compliant LLVM

    LLVMDemangle" "-lm" "-lz" "-lzstd" "-lcurses" "-lxml2" "-lc++" "-lm" "-lz" "-lzstd" "-lcurses" "-lxml2" "-lc++" "-liconv" "-lSystem" "-lc" "-lm" "-L" "/opt/homebrew/Cellar/rust/1.77.1/lib/rustlib/aarch64-apple-darwin/lib" "-o" "/Users/kenarab/git/concrete/target/release/deps/concrete-57fd24f9222538ba" "-Wl,-dead_strip" "-nodefaultlibs" "-L/opt/homebrew/lib" "-L/usr/local/lib"
      = note: ld: warning: ignoring duplicate libraries: '-lc++', '-lcurses', '-lm', '-lxml2', '-lz', '-lzstd'
              Undefined symbols for architecture arm64:
                "llvm::sys::RWMutexImpl::~RWMutexImpl()", referenced from:
                    (anonymous namespace)::LowerVectorToLLVMPass::runOnOperation() in libmlir_sys-1addc3a5c73d1d59.rlib[301](ConvertVectorToLLVMPass.cpp.o)
                    mlir::LLVMTypeConverter::~LLVMTypeConverter() in libmlir_sys-1addc3a5c73d1d59.rlib[301](ConvertVectorToLLVMPass.cpp.o)
                    mlir::LLVMTypeConverter::~LLVMTypeConverter() in libmlir_sys-1addc3a5c73d1d59.rlib[301](ConvertVectorToLLVMPass.cpp.o)
              ld: symbol(s) not found for architecture arm64
              clang: error: linker command failed with exit code 1 (use -v to see invocation)
              
    error: could not compile `concrete` (bin "concrete") due to 1 previous error
    make: *** [build] Error 101
    
    

    The cmake script for LLVM I used is this one

    cmake -G Ninja ../llvm \
      -DLLVM_ENABLE_PROJECTS=mlir \
      -DCMAKE_BUILD_TYPE=Release \
      -DLLVM_TARGETS_TO_BUILD="AArch64" \
      -DCMAKE_OSX_DEPLOYMENT_TARGET=14.0
    

    I built LLVM repo checking out tag llvmorg-17.0.6, as you stated LLVM 17 with MLIR enabled. For building and installing custm LLVM have run this command

    ninja build & ninja install
    

    Thank you!

    opened by kenarab 3
  • Add support for externs, pointers (ffi), casts

    Add support for externs, pointers (ffi), casts

    Adds the following:

    • Support to declare extern functions, like malloc.
    • Support for pointers to use for ffi in the std
    • Support for casts (needed to use pointers in a useful way)

    Todo:

    • [ ] Pointer arithmetic
    opened by edg-l 3
  • Add git attribute for syntax highlighting

    Add git attribute for syntax highlighting

    Since Concrete looks similar to Rust, using the same syntax highlighter for now should do wonders, especially for the GitHub code viewer.

    I have added the necessary setting under .gitattributes, you can see it in action here: https://github.com/erhant/concrete/blob/erhant/gitattr/examples/simple.con

    Note that this will also make *.con files count as Rust files for the language statistics, but I think that is okay for now. This attribute should be removed when Concrete highlighter is created & merged to Linguist.

    opened by erhant 3
  • Fix test examples

    Fix test examples

    In the array example, the mut keyword was missing.

    In the hello world example, the type checker doesn't allow to assign a 'char' to an u8. So i converted it to it's ascii code.

    opened by JulianGCalderon 2
  • Add array cast to pointer

    Add array cast to pointer

    Also fixes some GEPs that were not entirely correct, it now uses the gep using the array type and not the array element type.

    mod Main {
        pub extern fn puts(data: *mut char) -> i32;
    
        pub fn main() -> i32 {
            let x: [char; 13] = ['h','e','l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd', '!', '\0'];
            let z: *mut char = x as *mut char;
            puts(z);
            return 0;
        }
    }
    
    opened by edg-l 2
  • Module Constants

    Module Constants

    closes #75

    Adds support for simple literal constants:

    mod Example {
    	const foo: i32 = 10;
    	const var: i64 = 5;
    
    	fn main() -> i32 {
    		let vix: i32 = foo + 5;
    		return vix + (var as i32); // returns 20
    	}
    }
    

    The constant reference is resolved in the IR, by replacing it by the constant value.

    opened by JulianGCalderon 2
  • Add pointer offsetting (add) and intrinsic parsing

    Add pointer offsetting (add) and intrinsic parsing

    Added the ability to offset a pointer, this allows us to do the following:

    mod HelloWorld {
        pub extern fn malloc(size: u64) -> *mut u8;
        pub extern fn puts(data: *mut u8) -> i32;
    
        fn main() -> i32 {
            let origin: *mut u8 = malloc(12);
            let mut p: *mut u8 = origin;
    
            *p = 'H';
            p = p + 1;
            *p = 'e';
            p = p + 1;
            *p = 'l';
            p = p + 1;
            *p = 'l';
            p = p + 1;
             *p = 'o';
            p = p + 1;
             *p = ' ';
            p = p + 1;
             *p = 'W';
            p = p + 1;
             *p = 'o';
            p = p + 1;
             *p = 'r';
            p = p + 1;
             *p = 'l';
            p = p + 1;
             *p = 'd';
            p = p + 1;
            *p = '\0';
            puts(origin);
    
            return 0;
        }
    }
    

    Which prints "Hello World"

    Also added the ability to add attributes to functions, and declare intrinsics:

    mod MyMod {
        #[intrinsic = "simdsomething"]
        pub extern fn myintrinsic();
    }
    
    opened by edg-l 2
  • Add more type and mutability checks

    Add more type and mutability checks

    Checks if a variable is declared mutable and if not, if its being mutated.

    Checks for valid mutable borrows (but doesnt check for multiple mutable borrows yet).

    image

    image

    opened by edg-l 2
  • concrete code which should build but panics

    concrete code which should build but panics

    Running in linear-checker branch

    git checkout linear-checker
    
     cargo r build examples/linearExample01fail.con --check 
    

    Included in examples but not in tests, as it is not working

    mod LinearExampleStub {
    
    	struct Linear {
    	    x: i32,
    	    y: i32,
    	}
    	
    
    	fn main() -> i32 {
    		let mut xy: Linear = 
                        Linear {
                            x: 1,
                            y: 0,
                        };
    		if true { //if true because current stage of the AST does not support an anonymous block
    			// xy is "consumed". _consume has Linear type and goes out of scope
    			let _consume: Linear = xy;
                //FIXME this code is not compiling in concrete seems to be because a problem in lowering with variables defined inside a block
    		}
    		return xy.x;
    	}				
    }
    
    2024-06-19T19:05:48.106908Z DEBUG concrete_driver: Output file: "/Users/kenarab/git/concrete-ab/linearExample01fail.o"
    2024-06-19T19:05:48.106914Z DEBUG concrete_driver: Is library: false
    2024-06-19T19:05:48.106917Z DEBUG concrete_driver: Optlevel: None
    2024-06-19T19:05:48.106919Z DEBUG concrete_driver: Debug Info: Full
    2024-06-19T19:05:48.107155Z DEBUG concrete_ir::lowering::prepass: running ir prepass on module DefId { program_id: 0, id: 1 }
    thread 'main' panicked at crates/concrete_ir/src/lowering.rs:800:76:
    no local_idx
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    opened by kenarab 0
  • testcases in concrete_driver examples includes check phase for linearity check coverage

    testcases in concrete_driver examples includes check phase for linearity check coverage

    It can be checked, for example, at codecov or in codecov report bellow we are now covering linearity_check.rs source file.

    Linearity check algorithm can be aknowledged as completed when fn check_var_in_expr coverage of match statement is fully covered. It is expected to cover not with examples .con file, but manually building the conditions for coverage, as the current status of the parser is possible not to satisfy all conditions from a parsed source code.

    opened by kenarab 2
  • Found a case where compiler should throw an Error but panics

    Found a case where compiler should throw an Error but panics

    mod LinearExampleStub {
    
    	struct Linear {
    	    x: i32,
    	    y: i32,
    	}
    	
    	fn main() -> i32 {
    		let mut xy: Linear = 
                        Linear {
                            x: 0,
                            y: 1,
                        };
    		// linear value is written/consumed
    		consume_x(&xy);
    		return xy.x;
    	}
    	
    	fn consume_x(value: & mut Linear) {
    		value.x = value.x + 1;
    	}
    	
    }
    
    $cargo r build linearExample02.con --ir
       Compiling linearExample02 (linearExample02.con)
    
    thread 'main' panicked at crates/concrete_ir/src/lib.rs:475:38:
    not yet implemented
    note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
    
    

    Lines 474-475 of lib.rs

                TyKind::Param { .. } => todo!(),
                TyKind::Struct { .. } => todo!(),
    

    Changing parameter as non mutable yields an expected error conducting to make the parameter mutable. So this new feature (checking mutable types) should implement mutable parameters for being able to cover borrow checking part of LinearityCheck

    mod LinearExampleStub {
    
    	struct Linear {
    	    x: i32,
    	    y: i32,
    	}
    	
    	fn main() -> i32 {
    		let mut xy: Linear = 
                        Linear {
                            x: 0,
                            y: 1,
                        };
    		// linear value is written/consumed
    		consume_x(&xy);
    		return xy.x;
    	}
    	
    	fn consume_x(value: & Linear) {
    		value.x = value.x + 1;
    	}
    	
    }
    
    $cargo r build linearExample02.con --ir
       Compiling linearExample02 (linearExample02.con)
    
    [NotMutable] Error: 
        ╭─[linearExample02.con:22:3]
        β”‚
     21 β”‚     fn consume_x(value: & Linear) {
        β”‚                  ──┬──  
        β”‚                    ╰──── variable declared here
     22 β”‚        value.x = value.x + 1;
        β”‚        ──────────┬──────────  
        β”‚                  ╰──────────── can't mutate this variable because it's not mutable
    ────╯
    
    opened by kenarab 4
  • Print location of output files

    Print location of output files

    When invoking the bulid command with any of the options to output an intermediate artifact, e.g. AST, IR, etc the path to the output file should be printed.

    good first issue help wanted 
    opened by igaray 2
  • Make linker more consistent across systems

    Make linker more consistent across systems

    On linux use ld.so --list-diagnostics and parse the results to find the system dirs to pass to the linker. The output looks like this on my gentoo:

    ...
    path.prefix="/usr"
    path.rtld="/lib64/ld-linux-x86-64.so.2"
    path.sysconfdir="/etc"
    path.system_dirs[0x0]="/lib64/"
    path.system_dirs[0x1]="/usr/lib64/"
    version.release="stable"
    version.version="2.38"
    ...
    

    and like this on debian

    ...
    path.prefix="/usr"
    path.rtld="/lib64/ld-linux-x86-64.so.2"
    path.sysconfdir="/etc"
    path.system_dirs[0x0]="/lib/x86_64-linux-gnu/"
    path.system_dirs[0x1]="/usr/lib/x86_64-linux-gnu/"
    path.system_dirs[0x2]="/lib/"
    path.system_dirs[0x3]="/usr/lib/"
    version.release="stable"
    version.version="2.36"
    ...
    
    enhancement 
    opened by edg-l 0
Owner
Lambdaclass
A venture studio and a engineering powerhouse at the same time
Lambdaclass
A formal, politely verbose programming language for building next-gen reliable applications

vfpl Pronounced "Veepl", the f is silent A politely verbose programming language for building next-gen reliable applications Syntax please initialize

VFPL 4 Jun 27, 2022
Tagref helps you maintain cross-references in your code.

Tagref helps you maintain cross-references in your code. You can use it to help keep things in sync, document assumptions, manage invariants, etc. Airbnb uses it for their front-end monorepo. You should use it too!

Stephan Boyer 119 Dec 28, 2022
High-performance, Reliable ChatGLM SDK natural language processing in Rust-Lang

RustGLM for ChatGLM Rust SDK - δΈ­ζ–‡ζ–‡ζ‘£ High-performance, high-quality Experience and Reliable ChatGLM SDK natural language processing in Rust-Language 1.

Blueokanna 3 Feb 29, 2024
Northstar is a horizontally scalable and multi-tenant Kubernetes cluster provisioner and orchestrator

Northstar Northstar is a horizontally scalable and multi-tenant Kubernetes cluster provisioner and orchestrator. Explore the docs Β» View Demo Β· Report

Lucas Clerisse 1 Jan 22, 2022
Fast and scalable phylogenomic utilities 🐱 .

ogcat Fast and scalable phylogenomic utilities ?? . Installation Prebuilt binaries See releases. The musl binary for Linux should be the most compatib

Baqiao Liu 2 Dec 1, 2022
A simple workshop to learn how to write, test and deploy AWS Lambda functions using the Rust programming language

Rust Lambda Workshop Material to host a workshop on how to build and deploy Rust Lambda functions with AWS SAM and Cargo Lambda. Intro What is Serverl

Luciano Mammino 13 Mar 28, 2024
A simple to use rust package to generate or parse Twitter snowflake IDs,generate time sortable 64 bits unique ids for distributed systems

A simple to use rust package to generate or parse Twitter snowflake IDs,generate time sortable 64 bits unique ids for distributed systems (inspired from twitter snowflake)

houseme 5 Oct 6, 2022
Simple and efficient time representation in Rust.

timens-rs Simple and efficient timestamp representation. The main objective being interoperability with OCaml Core_kernel.Time_ns. A significant part

Laurent Mazare 7 Oct 17, 2022
A simple, efficient Rust library for handling asynchronous job processing and task queuing.

job_queue Setup cargo add job_queue Usage Create a job use job_queue::{Error, Job, typetag, async_trait, serde}; #[derive(Debug, serde::Deserialize,

Georges KABBOUCHI 3 Nov 30, 2023
A flexible, simple to use, immutable, clone-efficient String replacement for Rust

A flexible, simple to use, immutable, clone-efficient String replacement for Rust. It unifies literals, inlined, and heap allocated strings into a single type.

Scott Meeuwsen 119 Dec 12, 2022
A playground for creating generative art, buit with RustπŸ¦€ and WASMπŸ•Έ

Genny A playground for creating generative art, buit with Rust ?? and WASM ?? About This is a simple playground that allows me to explore ideas around

JoΓ£o Paiva 3 Mar 12, 2022
Bolt is a desktop application that is designed to make the process of developing and testing APIs easier and more efficient.

Bolt ⚑ Bolt is a desktop application that is designed to make the process of developing and testing APIs easier and more efficient. Quick start ??‍??

0xHiro 6 Mar 26, 2023
Czkawka is a simple, fast and easy to use app to remove unnecessary files from your computer.

Multi functional app to find duplicates, empty folders, similar images etc.

RafaΕ‚ Mikrut 9.2k Jan 4, 2023
A stupidly simple and easy to self-host, personal server for file hosting on the web

Grasswave CDN A stupidly simple and easy to self-host, personal server for file hosting on the web. Written in Rust. Thanks, @Maciejowski, for the sty

RafaΕ‚ Baran 3 Jan 3, 2023
Creating CLI's just got a whole lot better.

Staq Creating CLI's just got a whole lot better. Don't worry about CLI colouring, networking, Size of Executables, Speed ever again Have any doubts? R

null 12 Jun 6, 2021
🦊 An interactive cli for creating conventional commits.

?? koji An interactive cli for creating conventional commits, built on cocogitto and inspired by cz-cli. Installation Not yet. ?? Usage Using koji # C

Danny 40 Dec 8, 2022
A swiss army knife for creating binary modules for Garry's Mod in Rust.

A swiss army knife for creating binary modules for Garry's Mod in Rust.

William 38 Dec 24, 2022
Mononym is a library for creating unique type-level names for each value in Rust.

Mononym is a library for creating unique type-level names for each value in Rust.

MaybeVoid 52 Dec 16, 2022
Another attempt at creating a wrapper for fastcdc in node.js

Another attempt at creating a wrapper for fastcdc in node.js. This time using wasmbindgen instead of neon.

Mikola Lysenko 5 Jul 28, 2022