lambdaclass / concrete

Concrete is a simple programming language specifically crafted for creating highly scalable systems that are reliable, efficient, and easy to maintain.
Apache License 2.0
123 stars 11 forks source link

Module Constants #127

Closed JulianGCalderon closed 3 months ago

JulianGCalderon commented 4 months ago

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.

github-actions[bot] commented 4 months ago

Benchmarking factorial

Compiling factorial (factorial.con) Finished release in 30.102087ms Running 5000000 iterations Using input value: 20 Concrete Result = 2432902008176640000 Time taken : 62.82 ms Rust Result = 2432902008176640000 Time taken : 61.87 ms

Benchmarking fib

Compiling fib (fib.con) Finished release in 25.490309ms Running 5000 iterations Using input value: 20 Concrete Result = 6765 Time taken : 135.98 ms Rust Result = 6765 Time taken : 85.26 ms

codecov-commenter commented 4 months ago

Codecov Report

Attention: Patch coverage is 68.88889% with 28 lines in your changes are missing coverage. Please review.

Project coverage is 62.39%. Comparing base (bc72356) to head (350d3f6).

Files Patch % Lines
crates/concrete_ir/src/lowering.rs 68.88% 28 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #127 +/- ## ========================================== + Coverage 61.97% 62.39% +0.41% ========================================== Files 25 25 Lines 4610 4696 +86 ========================================== + Hits 2857 2930 +73 - Misses 1753 1766 +13 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.