Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorder project and add book [1] #151

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -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
41 changes: 36 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,29 @@ 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:
cargo 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
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ Meaning:
- :x: = work not started yet
- 🤔 = to be defined

Features:
Builtin Features:
- if/else ✔️
- while ✔️
- modules ✔️
Expand All @@ -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:

Expand Down
File renamed without changes.
36 changes: 0 additions & 36 deletions crates/concrete/Cargo.toml

This file was deleted.

66 changes: 0 additions & 66 deletions crates/concrete/tests/examples.rs

This file was deleted.

1 change: 1 addition & 0 deletions docs/book/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
6 changes: 6 additions & 0 deletions docs/book/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[book]
authors = ["Lambda Class"]
language = "en"
multilingual = false
src = "src"
title = "The Concrete Programming Language"
7 changes: 7 additions & 0 deletions docs/book/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 6 additions & 0 deletions docs/book/src/getting_started.md
Original file line number Diff line number Diff line change
@@ -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.
10 changes: 10 additions & 0 deletions docs/book/src/installation.md
Original file line number Diff line number Diff line change
@@ -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/
```
3 changes: 3 additions & 0 deletions docs/book/src/internal/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Internal Details

Here you can find several internal and implementation details of how Concrete is made.
59 changes: 59 additions & 0 deletions docs/book/src/internal/ir.md
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 5 additions & 0 deletions docs/book/src/intro.md
Original file line number Diff line number Diff line change
@@ -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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion tests/.gitkeep

This file was deleted.

File renamed without changes.
File renamed without changes.
Loading
Loading