84 lines
2.3 KiB
Plaintext
84 lines
2.3 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 compiler:
|
|
|
|
```bash title="Terminal"
|
|
cargo install [email protected]
|
|
```
|
|
|
|
Once the installation finishes, verify it by checking the version:
|
|
|
|
```bash title="Terminal"
|
|
mist version
|
|
```
|
|
|
|
---
|
|
|
|
## 2. Setting Up Your Project
|
|
|
|
Mist works alongside Cargo to handle the heavy lifting. Use `init` to scaffold a new project:
|
|
|
|
```bash title="Terminal"
|
|
cargo new my-mist-app
|
|
cd my-mist-app
|
|
mist init
|
|
```
|
|
|
|
This creates a `src/main.mist` and wires up the output directory (`.mist/src/`) in your `Cargo.toml`.
|
|
|
|
### Manual Setup
|
|
|
|
If you prefer to configure things yourself, create a `mist.json` file:
|
|
|
|
```json title="mist.json"
|
|
{
|
|
"src": "src",
|
|
"output": "build"
|
|
}
|
|
```
|
|
|
|
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.
|
|
|
|
---
|
|
|
|
## 3. 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 the short alias: 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 |
|
|
| `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 |
|