diff --git a/.github/workflows/book.yml b/.github/workflows/book.yml new file mode 100644 index 00000000..2fd58865 --- /dev/null +++ b/.github/workflows/book.yml @@ -0,0 +1,29 @@ +name: book + +on: + push: + branches: + - main + pull_request: + +jobs: + deploy: + runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v2 + + - name: Setup mdBook + uses: peaceiris/actions-mdbook@v2 + with: + mdbook-version: 'latest' + + - run: cd ./docs/book && mdbook build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + if: ${{ github.ref == 'refs/heads/main' }} + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./docs/book/book diff --git a/Cargo.toml b/Cargo.toml index de0c4d42..49da4e15 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,40 @@ -[workspace] -resolver = "2" +[package] +name = "concrete" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tracing = "0.1.41" +itertools = "0.13.0" +thiserror = "2.0.6" +educe = "0.5.11" +lalrpop-util = { version = "0.22.0", features = ["unicode"] } +logos = "0.15.0" +salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "c2a6d6238efa5f4642e8f0d2b5097f06b5f46dd0"} +ariadne = { version = "0.5.0", features = ["auto-color"] } +unescaper = "0.1.5" +logos-display = "0.1.3" + +melior = { version = "0.20.0", features = ["ods-dialects", "helpers"] } +llvm-sys = "191.0.0" +mlir-sys = "0.4.1" +anyhow = "1.0.94" +git2 = "0.19.0" +owo-colors = "4.1.0" +clap = { version = "4.5.23", features = ["derive"] } +tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } +serde = { version = "1.0.216", features = ["derive"] } +toml = "0.8.19" +test-case = "3.3.1" + +[build-dependencies] +lalrpop = "0.22.0" + +[dev-dependencies] +tempfile = "3.14.0" -members = [ - "crates/concrete", -] [profile.release] lto = true diff --git a/Makefile b/Makefile index 4ee6e02d..acc420c3 100644 --- a/Makefile +++ b/Makefile @@ -26,12 +26,12 @@ endif .PHONY: build build: check-deps - cargo build --workspace --release --all-features + cargo build --release --all-features .PHONY: check check: check-deps cargo fmt --all -- --check - cargo clippy --workspace --all-targets --all-features -- -D warnings + cargo clippy --all-targets --all-features -- -D warnings .PHONY: clean clean: @@ -39,12 +39,16 @@ clean: .PHONY: test test: check-deps - cargo test --workspace --all-targets --all-features + cargo test --all-targets --all-features .PHONY: coverage coverage: check-deps - cargo llvm-cov --verbose --all-features --all-targets --workspace --lcov --output-path lcov.info + cargo llvm-cov --verbose --all-features --all-targets --lcov --output-path lcov.info .PHONY: bench bench: check-deps ./bench/bench.sh + +.PHONY: book +book: + cd ./docs/book && mdbook serve --open diff --git a/README.md b/README.md index 990a19ee..1bcd5489 100644 --- a/README.md +++ b/README.md @@ -229,7 +229,7 @@ Meaning: - :x: = work not started yet - 🤔 = to be defined -Features: +Builtin Features: - if/else ✔️ - while ✔️ - modules ✔️ @@ -238,21 +238,23 @@ Features: - borrowing ✔️ - structs ✔️ - casts ✔️ -- arrays 🏗️ -- iterators :x: - for 🏗️ -- match :x: -- option :x: -- enums :x: -- impl :x: +- ffi 🏗️ - linear type checker 🏗️ +- impl block 🏗️ +- generics 🏗️ +- enums :x: +- match :x: - borrow checker :x: -- generics :x: - traits :x: - unsafe :x: + +Standard lib features: +- arrays 🏗️ +- iterators :x: +- option :x: - box :x: - rc (for cyclical data structures like graphs) :x: -- ffi :x: - operating system threads with move only semantics :x: - rayon-like :x: diff --git a/crates/concrete/build.rs b/build.rs similarity index 100% rename from crates/concrete/build.rs rename to build.rs diff --git a/crates/concrete/Cargo.toml b/crates/concrete/Cargo.toml deleted file mode 100644 index 9dc8956e..00000000 --- a/crates/concrete/Cargo.toml +++ /dev/null @@ -1,36 +0,0 @@ -[package] -name = "concrete" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -tracing = "0.1.41" -itertools = "0.13.0" -thiserror = "2.0.6" -educe = "0.5.11" -lalrpop-util = { version = "0.22.0", features = ["unicode"] } -logos = "0.15.0" -salsa = { git = "https://github.com/salsa-rs/salsa.git", rev = "c2a6d6238efa5f4642e8f0d2b5097f06b5f46dd0"} -ariadne = { version = "0.5.0", features = ["auto-color"] } -unescaper = "0.1.5" -logos-display = "0.1.3" - -melior = { version = "0.20.0", features = ["ods-dialects", "helpers"] } -llvm-sys = "191.0.0" -mlir-sys = "0.4.1" -anyhow = "1.0.94" -git2 = "0.19.0" -owo-colors = "4.1.0" -clap = { version = "4.5.23", features = ["derive"] } -tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } -serde = { version = "1.0.216", features = ["derive"] } -toml = "0.8.19" -test-case = "3.3.1" - -[build-dependencies] -lalrpop = "0.22.0" - -[dev-dependencies] -tempfile = "3.14.0" diff --git a/crates/concrete/tests/examples.rs b/crates/concrete/tests/examples.rs deleted file mode 100644 index 477b7d2f..00000000 --- a/crates/concrete/tests/examples.rs +++ /dev/null @@ -1,66 +0,0 @@ -use crate::common::{compile_and_run, compile_and_run_output}; -use concrete::session::OptLevel; -use test_case::test_case; - -mod common; - -#[test_case(include_str!("../../../examples/borrow.con"), "borrow", false, 2 ; "borrow.con")] -#[test_case(include_str!("../../../examples/factorial_if.con"), "factorial_if", false, 24 ; "factorial_if.con")] -#[test_case(include_str!("../../../examples/fib_if.con"), "fib_if", false, 55 ; "fib_if.con")] -#[test_case(include_str!("../../../examples/import.con"), "import", false, 12 ; "import.con")] -#[test_case(include_str!("../../../examples/simple.con"), "simple", false, 8 ; "simple.con")] -#[test_case(include_str!("../../../examples/while.con"), "while", false, 16 ; "while.con")] -#[test_case(include_str!("../../../examples/chars.con"), "chars", false, 117 ; "chars.con")] -#[test_case(include_str!("../../../examples/floats.con"), "floats", false, 1 ; "floats.con")] -#[test_case(include_str!("../../../examples/refs.con"), "refs", false, 6 ; "refs.con")] -#[test_case(include_str!("../../../examples/structs.con"), "structs", false, 8 ; "structs.con")] -#[test_case(include_str!("../../../examples/casts.con"), "casts", false, 2 ; "casts.con")] -#[test_case(include_str!("../../../examples/malloc.con"), "malloc", false, 5 ; "malloc.con")] -#[test_case(include_str!("../../../examples/while_if_false.con"), "while_if_false", false, 7 ; "while_if_false.con")] -#[test_case(include_str!("../../../examples/if_if_false.con"), "if_if_false", false, 7 ; "if_if_false.con")] -#[test_case(include_str!("../../../examples/for.con"), "for", false, 10 ; "for.con")] -#[test_case(include_str!("../../../examples/for_while.con"), "for_while", false, 10 ; "for_while.con")] -#[test_case(include_str!("../../../examples/arrays.con"), "arrays", false, 5 ; "arrays.con")] -#[test_case(include_str!("../../../examples/constants.con"), "constants", false, 20 ; "constants.con")] -#[test_case(include_str!("../../../examples/linearExample01.con"), "linearity", false, 2 ; "linearExample01.con")] -#[test_case(include_str!("../../../examples/linearExample02.con"), "linearity", false, 2 ; "linearExample02.con")] -#[test_case(include_str!("../../../examples/linearExample03if.con"), "linearity", false, 0 ; "linearExample03if.con")] -fn example_tests(source: &str, name: &str, is_library: bool, status_code: i32) { - assert_eq!( - status_code, - compile_and_run(source, name, is_library, OptLevel::None) - ); - assert_eq!( - status_code, - compile_and_run(source, name, is_library, OptLevel::Less) - ); - assert_eq!( - status_code, - compile_and_run(source, name, is_library, OptLevel::Default) - ); - assert_eq!( - status_code, - compile_and_run(source, name, is_library, OptLevel::Aggressive) - ); -} - -#[test_case(include_str!("../../../examples/hello_world_hacky.con"), "hello_world_hacky", false, "Hello World\n" ; "hello_world_hacky.con")] -#[test_case(include_str!("../../../examples/hello_world_array.con"), "hello_world_array", false, "hello world!\n" ; "hello_world_array.con")] -fn example_tests_with_output(source: &str, name: &str, is_library: bool, result: &str) { - assert_eq!( - result, - compile_and_run_output(source, name, is_library, OptLevel::None) - ); - assert_eq!( - result, - compile_and_run_output(source, name, is_library, OptLevel::Less) - ); - assert_eq!( - result, - compile_and_run_output(source, name, is_library, OptLevel::Default) - ); - assert_eq!( - result, - compile_and_run_output(source, name, is_library, OptLevel::Aggressive) - ); -} diff --git a/docs/book/.gitignore b/docs/book/.gitignore new file mode 100644 index 00000000..7585238e --- /dev/null +++ b/docs/book/.gitignore @@ -0,0 +1 @@ +book diff --git a/docs/book/book.toml b/docs/book/book.toml new file mode 100644 index 00000000..68b82226 --- /dev/null +++ b/docs/book/book.toml @@ -0,0 +1,6 @@ +[book] +authors = ["Lambda Class"] +language = "en" +multilingual = false +src = "src" +title = "The Concrete Programming Language" diff --git a/docs/book/src/SUMMARY.md b/docs/book/src/SUMMARY.md new file mode 100644 index 00000000..3151f421 --- /dev/null +++ b/docs/book/src/SUMMARY.md @@ -0,0 +1,7 @@ +# Summary + +- [The Concrete Programming Language](./intro.md) +- [Getting Started](./getting_started.md) + - [Installation](./installation.md) +- [Internal Details](./internal/index.md) + - [The IR](./internal/ir.md) diff --git a/docs/book/src/getting_started.md b/docs/book/src/getting_started.md new file mode 100644 index 00000000..7f614919 --- /dev/null +++ b/docs/book/src/getting_started.md @@ -0,0 +1,6 @@ +# Getting Started + +Here we will discuss: +- Installing Concrete on Linux, macOS. +- Writing a simple program. +- Using concrete to create a project. diff --git a/docs/book/src/installation.md b/docs/book/src/installation.md new file mode 100644 index 00000000..5f079cce --- /dev/null +++ b/docs/book/src/installation.md @@ -0,0 +1,10 @@ +# Installation + +Currently Concrete is distrubted via source only, so you will have to compile it: + +```bash +git clone https://github.com/lambdaclass/concrete.git +cd concrete +make build +cp ./target/release/concrete /usr/local/bin/ +``` diff --git a/docs/book/src/internal/index.md b/docs/book/src/internal/index.md new file mode 100644 index 00000000..2af62f55 --- /dev/null +++ b/docs/book/src/internal/index.md @@ -0,0 +1,3 @@ +# Internal Details + +Here you can find several internal and implementation details of how Concrete is made. diff --git a/docs/book/src/internal/ir.md b/docs/book/src/internal/ir.md new file mode 100644 index 00000000..de6a37fa --- /dev/null +++ b/docs/book/src/internal/ir.md @@ -0,0 +1,59 @@ +# The Concrete IR + +Currently in Concrete, the AST is lowered first to a IR to help support multiple targets and ease the generation of code on the end of the compilation process. + +This IR is based on the concept of basic blocks, where within each block there is a linear flow (i.e) there is no branching. + +Each block has a terminator, which for example can return or jump to another block, this is what defines the control flow of the program. + + +## The ProgramBody + +The `ProgramBody` holds the whole program, with all the modules defined within. + +All modules, functions, constants, struct types, types, etc have a defined `DefId`. + +The `ProgramBody` stores all of these in a flat structure, i.e, functions defined in a submodule are available for lookup directly by their id. + +## The ModuleBody + +Defines a module in concrete. + +This structure holds the ids of the functions, structs, modules, etc defined within this module. This allows to resolve imports. + +It also has a symbol table and a import table to aid during the construction of the IR. + +## The FnBody + +Defines a function in concrete. + +It holds the basic blocks and the locals used within. + +## The BasicBlock + +It holds a array of statements and a terminator. + +The statements have no branching. + +The terminator defines where to branch, return from a function, a switch, etc. + +## The Statement + +Currently there are 3 kinds of statements: assign, storage live, storage dead. + +Only assign is used currently: it contains a place and a rvalue. + +## Place + +This defines a place in memory, where you can load or store. + +## RValue + +A value found in the right hand side of an assignment, for example the use of an operand or a binary operation with 2 operands, a reference to a place, etc. + +## Operand + +A operand is a value, either from a place in memory or constant data. + +## Local +A local is a local variable within a function body, it is defined by a place and the type of local, such as temporary, argument or a return pointer. diff --git a/docs/book/src/intro.md b/docs/book/src/intro.md new file mode 100644 index 00000000..e14c538e --- /dev/null +++ b/docs/book/src/intro.md @@ -0,0 +1,5 @@ +# The Concrete Programming Language + +This book is a work in progress, much like the language itself, proceed with caution. + +Some stuff may be outdated. diff --git a/crates/concrete/src/ast/common.rs b/src/ast/common.rs similarity index 100% rename from crates/concrete/src/ast/common.rs rename to src/ast/common.rs diff --git a/crates/concrete/src/ast/constants.rs b/src/ast/constants.rs similarity index 100% rename from crates/concrete/src/ast/constants.rs rename to src/ast/constants.rs diff --git a/crates/concrete/src/ast/enums.rs b/src/ast/enums.rs similarity index 100% rename from crates/concrete/src/ast/enums.rs rename to src/ast/enums.rs diff --git a/crates/concrete/src/ast/expressions.rs b/src/ast/expressions.rs similarity index 100% rename from crates/concrete/src/ast/expressions.rs rename to src/ast/expressions.rs diff --git a/crates/concrete/src/ast/functions.rs b/src/ast/functions.rs similarity index 100% rename from crates/concrete/src/ast/functions.rs rename to src/ast/functions.rs diff --git a/crates/concrete/src/ast/imports.rs b/src/ast/imports.rs similarity index 100% rename from crates/concrete/src/ast/imports.rs rename to src/ast/imports.rs diff --git a/crates/concrete/src/ast/mod.rs b/src/ast/mod.rs similarity index 100% rename from crates/concrete/src/ast/mod.rs rename to src/ast/mod.rs diff --git a/crates/concrete/src/ast/modules.rs b/src/ast/modules.rs similarity index 100% rename from crates/concrete/src/ast/modules.rs rename to src/ast/modules.rs diff --git a/crates/concrete/src/ast/statements.rs b/src/ast/statements.rs similarity index 100% rename from crates/concrete/src/ast/statements.rs rename to src/ast/statements.rs diff --git a/crates/concrete/src/ast/structs.rs b/src/ast/structs.rs similarity index 100% rename from crates/concrete/src/ast/structs.rs rename to src/ast/structs.rs diff --git a/crates/concrete/src/ast/types.rs b/src/ast/types.rs similarity index 100% rename from crates/concrete/src/ast/types.rs rename to src/ast/types.rs diff --git a/crates/concrete/src/check/linearity_check.rs b/src/check/linearity_check.rs similarity index 100% rename from crates/concrete/src/check/linearity_check.rs rename to src/check/linearity_check.rs diff --git a/crates/concrete/src/check/linearity_check/errors.rs b/src/check/linearity_check/errors.rs similarity index 100% rename from crates/concrete/src/check/linearity_check/errors.rs rename to src/check/linearity_check/errors.rs diff --git a/crates/concrete/src/check/mod.rs b/src/check/mod.rs similarity index 100% rename from crates/concrete/src/check/mod.rs rename to src/check/mod.rs diff --git a/crates/concrete/src/codegen/compiler.rs b/src/codegen/compiler.rs similarity index 100% rename from crates/concrete/src/codegen/compiler.rs rename to src/codegen/compiler.rs diff --git a/crates/concrete/src/codegen/context.rs b/src/codegen/context.rs similarity index 100% rename from crates/concrete/src/codegen/context.rs rename to src/codegen/context.rs diff --git a/crates/concrete/src/codegen/errors.rs b/src/codegen/errors.rs similarity index 100% rename from crates/concrete/src/codegen/errors.rs rename to src/codegen/errors.rs diff --git a/crates/concrete/src/codegen/mod.rs b/src/codegen/mod.rs similarity index 100% rename from crates/concrete/src/codegen/mod.rs rename to src/codegen/mod.rs diff --git a/crates/concrete/src/codegen/module.rs b/src/codegen/module.rs similarity index 100% rename from crates/concrete/src/codegen/module.rs rename to src/codegen/module.rs diff --git a/crates/concrete/src/codegen/pass_manager.rs b/src/codegen/pass_manager.rs similarity index 100% rename from crates/concrete/src/codegen/pass_manager.rs rename to src/codegen/pass_manager.rs diff --git a/crates/concrete/src/driver/config.rs b/src/driver/config.rs similarity index 100% rename from crates/concrete/src/driver/config.rs rename to src/driver/config.rs diff --git a/crates/concrete/src/driver/db.rs b/src/driver/db.rs similarity index 100% rename from crates/concrete/src/driver/db.rs rename to src/driver/db.rs diff --git a/crates/concrete/src/driver/linker.rs b/src/driver/linker.rs similarity index 100% rename from crates/concrete/src/driver/linker.rs rename to src/driver/linker.rs diff --git a/crates/concrete/src/driver/mod.rs b/src/driver/mod.rs similarity index 100% rename from crates/concrete/src/driver/mod.rs rename to src/driver/mod.rs diff --git a/crates/concrete/src/grammar.lalrpop b/src/grammar.lalrpop similarity index 100% rename from crates/concrete/src/grammar.lalrpop rename to src/grammar.lalrpop diff --git a/crates/concrete/src/ir/lowering.rs b/src/ir/lowering.rs similarity index 100% rename from crates/concrete/src/ir/lowering.rs rename to src/ir/lowering.rs diff --git a/crates/concrete/src/ir/lowering/common.rs b/src/ir/lowering/common.rs similarity index 100% rename from crates/concrete/src/ir/lowering/common.rs rename to src/ir/lowering/common.rs diff --git a/crates/concrete/src/ir/lowering/errors.rs b/src/ir/lowering/errors.rs similarity index 100% rename from crates/concrete/src/ir/lowering/errors.rs rename to src/ir/lowering/errors.rs diff --git a/crates/concrete/src/ir/lowering/prepass.rs b/src/ir/lowering/prepass.rs similarity index 100% rename from crates/concrete/src/ir/lowering/prepass.rs rename to src/ir/lowering/prepass.rs diff --git a/crates/concrete/src/ir/mod.rs b/src/ir/mod.rs similarity index 100% rename from crates/concrete/src/ir/mod.rs rename to src/ir/mod.rs diff --git a/crates/concrete/src/lib.rs b/src/lib.rs similarity index 100% rename from crates/concrete/src/lib.rs rename to src/lib.rs diff --git a/crates/concrete/src/main.rs b/src/main.rs similarity index 100% rename from crates/concrete/src/main.rs rename to src/main.rs diff --git a/crates/concrete/src/parser/error.rs b/src/parser/error.rs similarity index 100% rename from crates/concrete/src/parser/error.rs rename to src/parser/error.rs diff --git a/crates/concrete/src/parser/lexer.rs b/src/parser/lexer.rs similarity index 100% rename from crates/concrete/src/parser/lexer.rs rename to src/parser/lexer.rs diff --git a/crates/concrete/src/parser/mod.rs b/src/parser/mod.rs similarity index 100% rename from crates/concrete/src/parser/mod.rs rename to src/parser/mod.rs diff --git a/crates/concrete/src/parser/tokens.rs b/src/parser/tokens.rs similarity index 100% rename from crates/concrete/src/parser/tokens.rs rename to src/parser/tokens.rs diff --git a/crates/concrete/src/session/mod.rs b/src/session/mod.rs similarity index 100% rename from crates/concrete/src/session/mod.rs rename to src/session/mod.rs diff --git a/tests/.gitkeep b/tests/.gitkeep deleted file mode 100644 index 8b137891..00000000 --- a/tests/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/crates/concrete/tests/checks.rs b/tests/checks.rs similarity index 100% rename from crates/concrete/tests/checks.rs rename to tests/checks.rs diff --git a/crates/concrete/tests/common.rs b/tests/common.rs similarity index 100% rename from crates/concrete/tests/common.rs rename to tests/common.rs diff --git a/tests/examples.rs b/tests/examples.rs new file mode 100644 index 00000000..c3725291 --- /dev/null +++ b/tests/examples.rs @@ -0,0 +1,66 @@ +use crate::common::{compile_and_run, compile_and_run_output}; +use concrete::session::OptLevel; +use test_case::test_case; + +mod common; + +#[test_case(include_str!("../examples/borrow.con"), "borrow", false, 2 ; "borrow.con")] +#[test_case(include_str!("../examples/factorial_if.con"), "factorial_if", false, 24 ; "factorial_if.con")] +#[test_case(include_str!("../examples/fib_if.con"), "fib_if", false, 55 ; "fib_if.con")] +#[test_case(include_str!("../examples/import.con"), "import", false, 12 ; "import.con")] +#[test_case(include_str!("../examples/simple.con"), "simple", false, 8 ; "simple.con")] +#[test_case(include_str!("../examples/while.con"), "while", false, 16 ; "while.con")] +#[test_case(include_str!("../examples/chars.con"), "chars", false, 117 ; "chars.con")] +#[test_case(include_str!("../examples/floats.con"), "floats", false, 1 ; "floats.con")] +#[test_case(include_str!("../examples/refs.con"), "refs", false, 6 ; "refs.con")] +#[test_case(include_str!("../examples/structs.con"), "structs", false, 8 ; "structs.con")] +#[test_case(include_str!("../examples/casts.con"), "casts", false, 2 ; "casts.con")] +#[test_case(include_str!("../examples/malloc.con"), "malloc", false, 5 ; "malloc.con")] +#[test_case(include_str!("../examples/while_if_false.con"), "while_if_false", false, 7 ; "while_if_false.con")] +#[test_case(include_str!("../examples/if_if_false.con"), "if_if_false", false, 7 ; "if_if_false.con")] +#[test_case(include_str!("../examples/for.con"), "for", false, 10 ; "for.con")] +#[test_case(include_str!("../examples/for_while.con"), "for_while", false, 10 ; "for_while.con")] +#[test_case(include_str!("../examples/arrays.con"), "arrays", false, 5 ; "arrays.con")] +#[test_case(include_str!("../examples/constants.con"), "constants", false, 20 ; "constants.con")] +#[test_case(include_str!("../examples/linearExample01.con"), "linearity", false, 2 ; "linearExample01.con")] +#[test_case(include_str!("../examples/linearExample02.con"), "linearity", false, 2 ; "linearExample02.con")] +#[test_case(include_str!("../examples/linearExample03if.con"), "linearity", false, 0 ; "linearExample03if.con")] +fn example_tests(source: &str, name: &str, is_library: bool, status_code: i32) { + assert_eq!( + status_code, + compile_and_run(source, name, is_library, OptLevel::None) + ); + assert_eq!( + status_code, + compile_and_run(source, name, is_library, OptLevel::Less) + ); + assert_eq!( + status_code, + compile_and_run(source, name, is_library, OptLevel::Default) + ); + assert_eq!( + status_code, + compile_and_run(source, name, is_library, OptLevel::Aggressive) + ); +} + +#[test_case(include_str!("../examples/hello_world_hacky.con"), "hello_world_hacky", false, "Hello World\n" ; "hello_world_hacky.con")] +#[test_case(include_str!("../examples/hello_world_array.con"), "hello_world_array", false, "hello world!\n" ; "hello_world_array.con")] +fn example_tests_with_output(source: &str, name: &str, is_library: bool, result: &str) { + assert_eq!( + result, + compile_and_run_output(source, name, is_library, OptLevel::None) + ); + assert_eq!( + result, + compile_and_run_output(source, name, is_library, OptLevel::Less) + ); + assert_eq!( + result, + compile_and_run_output(source, name, is_library, OptLevel::Default) + ); + assert_eq!( + result, + compile_and_run_output(source, name, is_library, OptLevel::Aggressive) + ); +} diff --git a/crates/concrete/tests/invalid_programs/call_param_count_mismatch.con b/tests/invalid_programs/call_param_count_mismatch.con similarity index 100% rename from crates/concrete/tests/invalid_programs/call_param_count_mismatch.con rename to tests/invalid_programs/call_param_count_mismatch.con diff --git a/crates/concrete/tests/invalid_programs/call_param_type_mismatch.con b/tests/invalid_programs/call_param_type_mismatch.con similarity index 100% rename from crates/concrete/tests/invalid_programs/call_param_type_mismatch.con rename to tests/invalid_programs/call_param_type_mismatch.con diff --git a/crates/concrete/tests/invalid_programs/immutable_mutation.con b/tests/invalid_programs/immutable_mutation.con similarity index 100% rename from crates/concrete/tests/invalid_programs/immutable_mutation.con rename to tests/invalid_programs/immutable_mutation.con diff --git a/crates/concrete/tests/invalid_programs/import1.con b/tests/invalid_programs/import1.con similarity index 100% rename from crates/concrete/tests/invalid_programs/import1.con rename to tests/invalid_programs/import1.con diff --git a/crates/concrete/tests/invalid_programs/import2.con b/tests/invalid_programs/import2.con similarity index 100% rename from crates/concrete/tests/invalid_programs/import2.con rename to tests/invalid_programs/import2.con diff --git a/crates/concrete/tests/invalid_programs/invalid_assign.con b/tests/invalid_programs/invalid_assign.con similarity index 100% rename from crates/concrete/tests/invalid_programs/invalid_assign.con rename to tests/invalid_programs/invalid_assign.con diff --git a/crates/concrete/tests/invalid_programs/invalid_borrow_mut.con b/tests/invalid_programs/invalid_borrow_mut.con similarity index 100% rename from crates/concrete/tests/invalid_programs/invalid_borrow_mut.con rename to tests/invalid_programs/invalid_borrow_mut.con diff --git a/crates/concrete/tests/invalid_programs/mutable_nonmut_borrow.con b/tests/invalid_programs/mutable_nonmut_borrow.con similarity index 100% rename from crates/concrete/tests/invalid_programs/mutable_nonmut_borrow.con rename to tests/invalid_programs/mutable_nonmut_borrow.con diff --git a/crates/concrete/tests/invalid_programs/type.con b/tests/invalid_programs/type.con similarity index 100% rename from crates/concrete/tests/invalid_programs/type.con rename to tests/invalid_programs/type.con diff --git a/crates/concrete/tests/invalid_programs/undeclared_var.con b/tests/invalid_programs/undeclared_var.con similarity index 100% rename from crates/concrete/tests/invalid_programs/undeclared_var.con rename to tests/invalid_programs/undeclared_var.con diff --git a/crates/concrete/tests/programs.rs b/tests/programs.rs similarity index 100% rename from crates/concrete/tests/programs.rs rename to tests/programs.rs