Getting started
To try RCE without installing anything, open the
RCE playground: it runs the reference
checker in your browser and shows whether a program is accepted and the
trace of each example. To run programs with rce run, install rce.
Install rce
rce is built from source with Rust. The repository pins the Rust version
in rust-toolchain.toml, and rustup installs that version for you.
git clone https://github.com/openIE-dev/rce
cd rce/spec/checker
cargo build --release
The program is now at target/release/rce. Put it on your PATH, for
example:
install -m 755 target/release/rce ~/.local/bin/
Prebuilt binaries of rce (together with the desktop IDE) for Linux,
macOS and Windows are on the
rce-ide releases page;
unpack one and put rce on your PATH instead of building.
Check that it runs. rce --version names the specification draft it
implements, and with no arguments rce prints the list of commands:
rce --version
rce
Hello, world
Make a file called hello.rce:
fn main()
emit "hello, world"
fn main() declares a function called main with no parameters. The body
is the indented line under it. RCE uses indentation for blocks, as Python
does. Indent with spaces; a tab is refused.
emit produces an output value. A program does not print directly. It
emits values, and the tool running it decides how to show them.
Run it:
$ rce run hello.rce
emit "hello, world"
exit status: 0
rce run evaluated main and showed each emitted value.
Checking without running
$ rce check hello.rce
ok hello.rce
exit status: 0
rce check reads the file, checks types and the
other rules, and evaluates every test the file contains. It never runs
main. You will use rce check and rce test far more often than
rce run.
Comments
A comment starts with # and runs to the end of the line.
# This line is a comment.
fn main()
emit 1 # so is the end of this one
What you learned
rce run FILErunsfn main()and shows what it emits.rce check FILEchecks a program without running it.- Blocks are marked by indentation with spaces.