Rho Rho language and toolchain

The handbook

How the Rho toolchain is put together, and how a project uses it.

Pages

The shape of a project

A project is a directory with a manifest:

my-service/
  module.yml        what this is, what it needs, what it generates and builds
  src/main.rho      the program
  tests/            Rho tests
  docs/             its documentation, if it has any

module.yml is the manifest the whole toolchain reads. Its module: block
says what the module is:

TypeWhat it isExample
rhoAn application: it has a main and generates a programthe registry
componentA tool: it publishes a command and is dispatched torho-fmt, rho-log
pluginAn extension: it adds to a tool rather than adding a commandrho-doc-toc
moduleA library: it exports declarations and nothing elsea shared package

Installing

rho install builds the toolchain and creates the local registry, which is
where installed modules live. What it needs, and what a fresh installation can
and cannot do, is handbook/installing.

Building

rho build <project-dir>

Every declared target is generated under build/generated/<target>/. A project
that declares c, go and go-server produces all three, because the choice
of backend is a property of the project rather than of the machine:

TargetWhat it produces
cA native executable, through cmake
goA Go command
go-serverA Go web service: routes, templates and a static directory

Running

rho run <project-dir>

A component is reached by the command its manifest publishes:

rho fmt src/main.rho
rho log -level info -subject registry -message started
rho test <project-dir>
rho doc . -out build/docs

rho <command> looks the command up among the installed components and runs the
one that published it. The CLI does not know these commands: they arrive with
the component, which is why adding a tool does not mean changing the CLI.