88 lines
2.8 KiB
Plaintext
88 lines
2.8 KiB
Plaintext
---
|
||
title: Get Started
|
||
description: This guide will walk you through installing the Mist CLI, setting up your development environment, and compiling your very first program.
|
||
icon: Rocket
|
||
---
|
||
|
||
## 1. Installation
|
||
|
||
Mist is currently distributed as a Cargo crate. To get started, you'll need to have the Rust toolchain installed.
|
||
|
||
Run the following command to install the Mist toolchain:
|
||
|
||
```bash title="Terminal"
|
||
cargo install [email protected]
|
||
```
|
||
|
||
> (ℹ) For a more streamlined development experience, Install the following VSCode extensions:
|
||
> 1. [Mist syntax highlighting VSCode extension](https://marketplace.visualstudio.com/items?itemName=selimaj-dev.mist-syntax)
|
||
> 2. [Mist analyzer LSP VSCode extension](https://marketplace.visualstudio.com/items?itemName=selimaj-dev.mist-analyzer)
|
||
|
||
Once the installation finishes, verify it by checking the version:
|
||
|
||
```bash title="Terminal"
|
||
mist version
|
||
```
|
||
|
||
---
|
||
|
||
## 2. Setting Up Your Cargo Project
|
||
|
||
Mist works alongside Cargo to handle the heavy lifting. Use `cargo new` or `cargo init` to scaffold a new project:
|
||
|
||
```bash title="Terminal"
|
||
cargo new my-mist-app
|
||
cd my-mist-app
|
||
```
|
||
|
||
This creates a `src/main.mist` and wires up the output directory (`.mist/src/`) in your `Cargo.toml`.
|
||
|
||
### 3. Adding mist to your Cargo project
|
||
|
||
Mist needs a `Mist.toml` in the root of the project (Alongside `Cargo.toml`) to know what to transpile as the main file (eg. main.mist, lib.mist).
|
||
|
||
```toml title="Mist.toml"
|
||
# main.mist is now the main package
|
||
package = "main.mist"
|
||
|
||
# Side packages that work as cargo binaries
|
||
packages = []
|
||
```
|
||
|
||
Source files go in `src/` and the transpiled output goes to `.mist/src/`. Non-Mist files in `src/` (e.g. Rust sidecar files) are copied through as-is.
|
||
|
||
---
|
||
|
||
## 4. Your First Program
|
||
|
||
Create a new file at `src/main.mist` and add the following code:
|
||
|
||
```mist title="src/main.mist"
|
||
void main() {
|
||
println!("Hello World!");
|
||
}
|
||
```
|
||
|
||
### Build and Run
|
||
|
||
```bash title="Terminal"
|
||
mist run # or: mist r
|
||
mist build # or: mist b
|
||
mist check # or: mist c
|
||
mist transpile # or: mist t
|
||
```
|
||
|
||
---
|
||
|
||
## Command Reference
|
||
|
||
| Command | Alias | Description |
|
||
| -------------------- | ----- | ----------------------------------------------- |
|
||
| `mist init` | | Initializes a new Mist project (Deprecated) |
|
||
| `mist run` | `r` | Runs the project in the current directory |
|
||
| `mist build` | `b` | Builds the project in the current directory |
|
||
| `mist transpile` | `t` | Transpiles the project in the current directory |
|
||
| `mist check` | `c` | Checks the project in the current directory |
|
||
| `mist version` | `-v` | Prints the compiler version |
|
||
| `mist help` | `-h` | Prints this message |
|