constructo-runtime 0.1.0

The syntax of Constructo data-values: the lexer, parser and printer that generated code depends on
Documentation
# constructo-runtime

The syntax of [Constructo](https://github.com/sfkleach/constructo) data-values: the lexer, the parser, the tree of a
value, the printer of values, and what the codecs that `constructo codegen` writes call.

## Who needs it

A program that uses Rust code generated by `constructo codegen --lang=rust` depends on this crate. The first lines of
the generated file name the version that it needs:

```rust
//! It needs the crate constructo-runtime 0.1.
```

and the program adds that version to its own `Cargo.toml`:

```toml
[dependencies]
constructo-runtime = "0.1"
```

The generated code reads and writes values with this crate, so that it reads the same syntax as `constructo check`.
How the generated code is used is in the
[spec of `constructo codegen`](https://github.com/sfkleach/constructo/blob/main/docs/specs/codegen-command.md).

## The tree of a value

A program can also read values without generated code, as a tree that is not checked against any type:

```rust
use constructo_runtime::ast::ValueKind;
use constructo_runtime::codec::{parse, write_text};

let values = parse("Move { x: 1, y: -2 };").expect("a value");
if let ValueKind::Tagged { name, .. } = &values[0].kind {
    assert_eq!(name, "Move");
}
assert_eq!(write_text(&values), "Move { x: 1, y: -2 };\n");
```

## Versions

The version of this crate is that of `constructo`, since the two are released together, and `constructo` depends on
exactly that version. Before 1.0, a change to the API is made only in a new minor version, as Cargo's rules for
compatibility allow, so a generated file that names `0.1` works with every `0.1.x`.

## Licence

MIT, as in [LICENSE](LICENSE).