mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-14 07:29:02 +03:00
Merge pull request #2060 from rtfeldman/nightly_examples
Docs: running nightly examples
This commit is contained in:
commit
0c66433373
@ -1,11 +1,10 @@
|
||||
# Building the Roc compiler from source
|
||||
|
||||
|
||||
## Installing LLVM, Zig, valgrind, and Python 2.7
|
||||
## Installing LLVM, Zig, valgrind, and Python
|
||||
|
||||
To build the compiler, you need these installed:
|
||||
|
||||
* Python 2.7 (Windows only), `python-is-python3` (Ubuntu)
|
||||
* [Zig](https://ziglang.org/), see below for version
|
||||
* `libxkbcommon` - macOS seems to have it already; on Ubuntu or Debian you can get it with `apt-get install libxkbcommon-dev`
|
||||
* On Debian/Ubuntu `sudo apt-get install pkg-config`
|
||||
|
28
README.md
28
README.md
@ -4,9 +4,6 @@ Roc is a language for making delightful software.
|
||||
|
||||
If you already know [Elm](https://elm-lang.org/), then [Roc for Elm Programmers](https://github.com/rtfeldman/roc/blob/trunk/roc-for-elm-programmers.md) may be of interest.
|
||||
|
||||
If you're curious about where the language's name and logo came from,
|
||||
[here's an explanation](https://github.com/rtfeldman/roc/blob/trunk/name-and-logo.md).
|
||||
|
||||
You can get help and discuss with other people on the [Roc Zulip chat](https://roc.zulipchat.com).
|
||||
|
||||
## State of Roc
|
||||
@ -16,26 +13,20 @@ Many programs can however be compiled correctly. Check out [examples](examples)
|
||||
|
||||
## Getting started
|
||||
|
||||
1. [Install Rust](https://rustup.rs/)
|
||||
2. [Build from source](BUILDING_FROM_SOURCE.md)
|
||||
3. In a terminal, run this from the root folder:
|
||||
```
|
||||
cargo run repl
|
||||
```
|
||||
4. Check out [these tests](https://github.com/rtfeldman/roc/blob/trunk/cli/tests/repl_eval.rs) for examples of using the REPL
|
||||
- [Linux x86](getting_started/linux_x86.md)
|
||||
- [Windows](getting_started/windows.md)
|
||||
- [Other](getting_started/other.md)
|
||||
|
||||
### Examples
|
||||
|
||||
Took a look at the [examples folder](examples), [examples/benchmarks](examples/benchmarks) contains some larger examples.
|
||||
|
||||
Run examples as follows:
|
||||
1. Navigate to `/examples`
|
||||
2. Run with:
|
||||
```
|
||||
cargo run hello-world/Hello.roc
|
||||
cargo run examples/hello-world/Hello.roc
|
||||
```
|
||||
Some examples like `examples/benchmarks/NQueens.roc` require input after running.
|
||||
For NQueens, input 10 in the terminal and press enter.
|
||||
For NQueens, input 10 in the terminal and press enter.
|
||||
|
||||
[examples/benchmarks](examples/benchmarks) contains larger examples.
|
||||
|
||||
## Applications and Platforms
|
||||
|
||||
@ -108,3 +99,8 @@ been able to find beginner-friendly projects to get people up to speed gradually
|
||||
|
||||
If you're interested in getting involved, check out
|
||||
[CONTRIBUTING.md](https://github.com/rtfeldman/roc/blob/trunk/CONTRIBUTING.md)!
|
||||
|
||||
## Name and Logo
|
||||
|
||||
If you're curious about where the language's name and logo came from,
|
||||
[here's an explanation](https://github.com/rtfeldman/roc/blob/trunk/name-and-logo.md).
|
||||
|
30
getting_started/linux_x86.md
Normal file
30
getting_started/linux_x86.md
Normal file
@ -0,0 +1,30 @@
|
||||
1. Download the latest nightly from the assets [here](https://github.com/rtfeldman/roc/releases).
|
||||
2. Untar the archive:
|
||||
```
|
||||
tar -xf roc_nightly-linux_x86_64-<VERSION>.tar.gz
|
||||
```
|
||||
3. To be able to run examples:
|
||||
- for the Rust example:
|
||||
```
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
```
|
||||
- for the zig example:
|
||||
```
|
||||
wget https://ziglang.org/download/0.8.1/zig-linux-x86_64-0.8.1.tar.xz
|
||||
tar -xf zig-linux-x86_64-0.8.1.tar.xz
|
||||
sudo ln -s $(pwd)/zig-linux-x86_64-0.8.1/zig /usr/local/bin/zig
|
||||
```
|
||||
- for the C example:
|
||||
```
|
||||
sudo apt install clang
|
||||
```
|
||||
4. Run examples with:
|
||||
```
|
||||
# Rust
|
||||
./roc examples/hello-rust/Hello.roc
|
||||
# Zig
|
||||
./roc examples/hello-zig/Hello.roc
|
||||
# C
|
||||
./roc examples/hello-world/Hello.roc
|
||||
```
|
||||
5. See [here](../README.md#examples) for the other examples.
|
13
getting_started/other.md
Normal file
13
getting_started/other.md
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
1. [Install Rust](https://rustup.rs/)
|
||||
2. [Build roc from source](../BUILDING_FROM_SOURCE.md)
|
||||
3. Run examples with:
|
||||
```
|
||||
# Rust
|
||||
cargo run examples/hello-rust/Hello.roc
|
||||
# Zig
|
||||
cargo run examples/hello-zig/Hello.roc
|
||||
# C
|
||||
cargo run examples/hello-world/Hello.roc
|
||||
```
|
||||
4. See [here](../README.md#examples) for the other examples.
|
2
getting_started/windows.md
Normal file
2
getting_started/windows.md
Normal file
@ -0,0 +1,2 @@
|
||||
Windows is not yet supported, we have a big project in the works that will make it easier to achieve this.
|
||||
Until then we recommend using Ubuntu through the "Windows Subsystem for Linux".
|
Loading…
Reference in New Issue
Block a user