diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0cd5643..08fd086 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -35,12 +35,6 @@ Run this command to build and test the main Rust codebase: cargo test ``` -Run this command to make a release build and install it on your `PATH`: - -```sh -cargo install --locked --path crates/adroit -``` - ## JavaScript We use Bun for our [website][] and for our VS Code extension. To work with the diff --git a/packages/website/src/index.md b/packages/website/src/index.md index 2312515..aae0a53 100644 --- a/packages/website/src/index.md +++ b/packages/website/src/index.md @@ -11,26 +11,34 @@ platform from the latest GitHub release: ### macOS Apple Silicon ```sh -sudo curl -L https://github.com/adroit-lang/adroit/releases/download/v0.2.2/adroit-aarch64-apple-darwin -o /usr/local/bin/adroit && sudo chmod +x /usr/local/bin/adroit +sudo curl -L https://github.com/adroit-lang/adroit/releases/download/v0.2.2/adroit-aarch64-apple-darwin -o /usr/local/bin/adroit +sudo chmod +x /usr/local/bin/adroit ``` ### macOS Intel ```sh -sudo curl -L https://github.com/adroit-lang/adroit/releases/download/v0.2.2/adroit-x86_64-apple-darwin -o /usr/local/bin/adroit && sudo chmod +x /usr/local/bin/adroit +sudo curl -L https://github.com/adroit-lang/adroit/releases/download/v0.2.2/adroit-x86_64-apple-darwin -o /usr/local/bin/adroit +sudo chmod +x /usr/local/bin/adroit ``` ### Linux x64 ```sh -sudo curl -L https://github.com/adroit-lang/adroit/releases/download/v0.2.2/adroit-x86_64-unknown-linux-musl -o /usr/local/bin/adroit && sudo chmod +x /usr/local/bin/adroit +sudo curl -L https://github.com/adroit-lang/adroit/releases/download/v0.2.2/adroit-x86_64-unknown-linux-musl -o /usr/local/bin/adroit +sudo chmod +x /usr/local/bin/adroit ``` ### Building from source If none of those prebuilt binaries work for you, you can instead build Adroit -from source by following the [`CONTRIBUTING.md`][] instructions in the GitHub -repo. +from source. First install [Git][] and [Rust][], then run these commands: + +```sh +git clone --depth 1 --branch v0.2.2 https://github.com/adroit-lang/adroit.git +cd adroit +cargo install --locked --path crates/adroit +``` ## Editor support @@ -50,9 +58,50 @@ adroit --help Currently Adroit is in the early stages of development and has no interpreter and no compiler backend, so there is no way to run an Adroit program. +By convention, Adroit source file names end with the `.adroit` extension. + ## Language -Here is an example function implementing matrix multiplication in Adroit: +Here is an Adroit function that takes a floating-point number as input, and +returns the square of that number as output: + +```adroit +def square(x: Float): Float = x * x +``` + +Within the body of a function, you can use `let` to give an intermediate value a +name; then you write the return value of the function after all your +`let`-bindings: + +```adroit +def foo(x: Float, y: Float): Float = + let a = x + y + let b = x * y + a / b +``` + +Indentation is never significant in Adroit, but newlines are sometimes +significant; as you can see above, you can end a `let`-binding with a newline, +but if you'd prefer to put more on one line, you can instead use a semicolon: + +```adroit +def tesseract(x: Float): Float = let y = x * x; y * y +``` + +Functions can be generic: + +```adroit +def identity[T](x: T): T = x +``` + +Adroit currently has three standard library modules: + +- `"array"` +- `"autodiff"` +- `"math"` + +Here is an example using a couple functions from the `"array"` module to +implement matrix multiplication: ```adroit import "array" use for, sum @@ -65,5 +114,6 @@ def mmul[M, N, P]( sum(for k => a[i, k] * b[k, j]) ``` -[`CONTRIBUTING.md`]: https://github.com/adroit-lang/adroit/blob/main/CONTRIBUTING.md [from the VS Code Marketplace]: https://marketplace.visualstudio.com/items?itemName=adroit-lang.adroit-vscode +[git]: https://git-scm.com/downloads +[rust]: https://www.rust-lang.org/tools/install