slovo/README.md

459 lines
21 KiB
Markdown

# Slovo
Slovo (ⰔⰎⰑⰂⰑ) is a typed structural programming language and toolchain.
This repository is the canonical public monorepo for the language design,
standard library source, compiler, runtime, examples, benchmarks, and technical
documents.
Current release: `1.0.0-beta.16`.
## Repository Layout
```text
compiler/ Glagol, the first Slovo compiler
runtime/ C runtime used by hosted native builds
lib/std/ source-authored Slovo standard-library facades
examples/ compiler-supported Slovo examples and projects
benchmarks/ local benchmark comparison harnesses
docs/language/ language manifest, specs, roadmap, and release notes
docs/compiler/ compiler manifest, roadmap, and release notes
docs/papers/ whitepapers and generated publication PDFs
scripts/ local release and document tooling
```
## Beta Scope
`1.0.0-beta.16` keeps the `1.0.0-beta` language baseline, includes the
`1.0.0-beta.1` tooling/install hardening slice, the `1.0.0-beta.2`
runtime/resource foundation bundle, the `1.0.0-beta.3` standard-library
stabilization bundle, the `1.0.0-beta.4` language-usability diagnostics
bundle, the `1.0.0-beta.5` local package/workspace discipline bundle, and the
`1.0.0-beta.6` loopback networking foundation, plus the `1.0.0-beta.7`
serialization/data-interchange foundation and the `1.0.0-beta.8` concrete type
alias foundation, the `1.0.0-beta.9` collection alias unification and
generic reservation slice, the `1.0.0-beta.10` developer-experience API
discovery slice, and the `1.0.0-beta.11` local package API documentation
slice, plus the `1.0.0-beta.12` concrete vector query and prefix parity
slice, the `1.0.0-beta.13` diagnostic catalog and schema policy slice, the
`1.0.0-beta.14` benchmark suite catalog and metadata gate, and the
`1.0.0-beta.15` reserved generic collection boundary hardening and collection
ledger, plus the `1.0.0-beta.16` string scanning and token boundary
foundation.
The language baseline supports practical local command-line, file, and
loopback-network programs with:
- modules, explicit imports, packages, and local workspaces
- `new`, `check`, `fmt`, `test`, `doc`, `symbols`, `build`, `run`, and
`clean`
- `i32`, `i64`, `u32`, `u64`, `f64`, `bool`, `string`, and internal `unit`
- structs, enums, fixed arrays, concrete vectors, option/result families, and
current `match`
- module-local transparent concrete type aliases
- explicit `std/*.slo` imports from `lib/std`, installed `share/slovo/std`, or
`SLOVO_STD_PATH`
- beta-scoped loopback TCP handles through `std.net`
- JSON string quoting and compact JSON text construction through `std.json`
- hosted native builds through LLVM IR, Clang, and `runtime/runtime.c`
The generated standard-library API catalog is a beta discovery aid: it lists
exported helper signatures from `lib/std/*.slo`, normalizes module-local
concrete aliases such as `VecI32` and `ResultU64` to their concrete public
types, and omits non-exported helpers and `(type ...)` aliases.
`glagol symbols <file.slo|project|workspace>` emits deterministic
editor-facing S-expression metadata for modules, imports, exports, aliases,
structs, enums, functions, tests, source spans, and workspace package names.
`glagol doc <file|project|workspace> -o <dir>` now includes deterministic public
API sections for local package and module documentation: exact exported
function signatures, exported struct fields, exported enum variants and payload
types, non-export filtering, and module-local alias normalization.
The `1.0.0-beta.12` vector parity slice adds source-authored helper coverage
only: `std.vec_i64` gains `count_of`, `starts_with`, `without_prefix`,
`ends_with`, and `without_suffix`, while `std.vec_f64` gains `count_of`.
The `1.0.0-beta.13` diagnostics slice documents the beta
`slovo.diagnostic` version `1` policy in
[`docs/language/DIAGNOSTICS.md`](docs/language/DIAGNOSTICS.md): the
S-expression/JSON relationship, required and optional fields, JSON-line
discipline, source-less diagnostics, manifest diagnostic metadata,
compatibility and migration classes, and the current golden diagnostic code
catalog.
The `1.0.0-beta.14` benchmark metadata slice documents the existing benchmark
suite catalog in [`benchmarks/README.md`](benchmarks/README.md). It explains
`python3 benchmarks/runner.py --suite-list` for the human-readable suite
inventory and `python3 benchmarks/runner.py --suite-list --json` for beta
tooling metadata, with required scaffold-file verification for each current
suite. Benchmark timings remain local-machine evidence only; the JSON field
set is not a stable public schema.
The `1.0.0-beta.15` collection ledger and reserved diagnostic hardening slice
adds
[`docs/language/COLLECTIONS.md`](docs/language/COLLECTIONS.md) as the
docs/design ledger for current concrete collection and value-family
boundaries. It links to the generated
[`docs/language/STDLIB_API.md`](docs/language/STDLIB_API.md) catalog for exact
public helper signatures, records design pressure from duplicated concrete
vector/option/result families, defines prerequisites before executable
generics, generic aliases, maps, sets, iterators, mutable vectors, or
slice/view APIs can be promoted, and treats current unsupported diagnostics as
boundaries. It rewords affected reserved-boundary diagnostics from
beta.9-specific text to current-beta wording while preserving diagnostic
codes, schema, spans, expected/found values, hints, and output shape. It
changes no source language, runtime, stdlib/API surface, benchmark metadata
schema, ABI/layout behavior, or performance claim.
The `1.0.0-beta.16` string scanning and token boundary foundation adds
source facades and explicit examples for `std.string.byte_at_result`,
`std.string.slice_result`, `std.string.starts_with`, and
`std.string.ends_with`. These helpers are byte-oriented over the current
NUL-terminated runtime string representation; invalid indexes and ranges return
`err 1`, and substring allocation failure follows the existing string
allocation trap policy. This release does not promise Unicode scalar,
grapheme, display-width, or locale semantics; does not add JSON parsing,
object/array parsing, tokenizers, a language slice/view feature, or a stable
stdlib/API freeze.
Still deferred before stable: executable generics, generic aliases, maps/sets,
broad package registry semantics, stable Markdown schema, stable stdlib/API
compatibility freeze, DNS/TLS/async networking, LSP/watch guarantees, SARIF
and daemon protocols, stable `1.0.0` diagnostics freeze,
re-exports/globs/hierarchical modules, mutable vectors, slice/view APIs,
iterators, additional compiler-known runtime names, stable ABI and layout,
performance claims, stable benchmark JSON metadata schema, and runtime changes
for generic collections.
The next likely language slice after `1.0.0-beta.16` should continue from the
developer-experience, package, benchmark metadata, collection, or string
processing lanes without claiming executable generics, maps, sets, traits,
inference, monomorphization, iterators, ABI stability, broad runtime changes,
LSP/watch protocols, SARIF/daemon protocols, registry semantics, stable
Markdown schema, stable benchmark JSON schema, a stable `1.0.0` diagnostics
freeze, standard-library/API compatibility freeze, mutable vectors, language
slice/view APIs, additional runtime names, Unicode/grapheme semantics, JSON
parsing, object/array parsing, or performance claims until the contract and
gates are explicit.
## Build And Test
```bash
cargo test --manifest-path compiler/Cargo.toml
```
Run the full local release gate:
```bash
./scripts/release-gate.sh
```
Build the compiler binary:
```bash
cargo build --manifest-path compiler/Cargo.toml
./compiler/target/debug/glagol --version
```
Create and check a project:
```bash
./compiler/target/debug/glagol new hello
SLOVO_STD_PATH="$PWD/lib/std" ./compiler/target/debug/glagol check hello
SLOVO_STD_PATH="$PWD/lib/std" ./compiler/target/debug/glagol test hello
```
Build a native executable when Clang is available:
```bash
SLOVO_STD_PATH="$PWD/lib/std" ./compiler/target/debug/glagol build hello -o hello/bin
```
## 1.0.0-beta.1 Tooling Additions
The `1.0.0-beta.1` release improves the common local development and install
loop without adding new source-language syntax.
Build and execute in one step:
```bash
SLOVO_STD_PATH="$PWD/lib/std" ./compiler/target/debug/glagol run hello
SLOVO_STD_PATH="$PWD/lib/std" ./compiler/target/debug/glagol clean hello
```
Create alternate project shapes:
```bash
./compiler/target/debug/glagol new numbers --template library
./compiler/target/debug/glagol new workspace-demo --template workspace
```
Install the current checkout:
```bash
PREFIX="$HOME/.local" ./scripts/install.sh
```
The installed layout is:
```text
<prefix>/bin/glagol
<prefix>/share/slovo/std/*.slo
<prefix>/share/slovo/runtime/runtime.c
```
Installed `glagol` discovers `share/slovo/std` and
`share/slovo/runtime/runtime.c` relative to its executable. `SLOVO_STD_PATH`
can still override standard-library search, `SLOVO_RUNTIME_C` or
`GLAGOL_RUNTIME_C` can override the runtime C input, and `GLAGOL_CLANG` can
select the Clang-compatible compiler.
## 1.0.0-beta.2 Runtime Resource Foundation
The `1.0.0-beta.2` release adds beta-scoped runtime/resource foundation work:
- `std.fs.open_text_read_result`
- `std.fs.read_open_text_result`
- `std.fs.close_result`
- `std.fs.exists`
- `std.fs.is_file`
- `std.fs.is_dir`
- `std.fs.remove_file_result`
- `std.fs.create_dir_result`
- matching explicit `lib/std/fs.slo` facades
These APIs use beta-scoped opaque `i32` file handles. They do not claim stable
file descriptors, writable streams, binary IO, directory handles, sockets,
async IO, platform error codes, or stable handle ABI/layout. Directory creation
is intentionally narrow and does not imply directory enumeration or recursive
filesystem APIs.
## 1.0.0-beta.3 Standard Library Stabilization
The `1.0.0-beta.3` release starts the standard-library stabilization slice. It
adds a generated standard-library API catalog and
`examples/projects/stdlib-composition`, a checked/tested/run-capable program
that composes `std.fs`, `std.string`, `std.math`, and `std.io`.
## 1.0.0-beta.4 Language Usability Diagnostics
The `1.0.0-beta.4` release improves diagnostics without changing the source
language surface. Project/workspace build and run entry failures now use
entry-specific diagnostic codes, and non-exhaustive `match` diagnostics have
clearer wording with deterministic found-arm output.
## 1.0.0-beta.5 Package And Workspace Discipline
The `1.0.0-beta.5` release tightens local package/workspace behavior. Local
workspaces may declare `[workspace] default_package = "name"` to select the
build/run entry package when multiple packages have entry modules. Duplicate
normalized workspace members and missing default-package references are now
dedicated diagnostics. `glagol doc <workspace> -o <dir>` includes a workspace
package/dependency summary, new workspace templates declare
`default_package = "app"`, and `docs/language/PACKAGES.md` documents the beta
local-package rules. Remote registries, lockfiles, semantic-version solving,
package publishing, and stable package ABI/layout remain deferred.
## 1.0.0-beta.6 Networking Foundation
The `1.0.0-beta.6` release adds a narrow blocking loopback TCP foundation:
- compiler-known `std.net.tcp_*_result` calls for connect, listen,
bound-port lookup, accept, read-all, write-text, and close
- `lib/std/net.slo` source facades and explicit std/local example projects
- opaque beta-scoped `i32` socket handles with concrete `result` values
This is not a general networking stack. DNS, TLS, UDP, non-loopback binding,
async IO, HTTP frameworks, rich host-error ADTs, stable socket ABI/layout, and
automatic resource ownership remain deferred.
## 1.0.0-beta.7 Serialization And Data Interchange
The `1.0.0-beta.7` release adds a narrow JSON text-construction foundation:
- compiler-known `std.json.quote_string` for deterministic compact JSON string
quoting
- `lib/std/json.slo` source helpers for scalar values, fields, small arrays,
and small objects
- explicit std/local JSON example projects and a `json-quote-loop` benchmark
scaffold
This is not a complete JSON library. Full parsing, recursive JSON values,
maps/sets, streaming encoders, schema validation, Unicode normalization, and a
stable data-interchange API freeze remain deferred.
## 1.0.0-beta.8 Concrete Type Alias Foundation
The `1.0.0-beta.8` release adds transparent concrete type aliases:
```slo
(type JsonText string)
```
Aliases are module-local names for already supported concrete target types.
They may appear in local signatures and annotations, but they do not create new
runtime representations or stable ABI names. Project imports of functions that
use aliases see the resolved concrete target type. Alias exports, imports,
re-exports, generic aliases, parameterized aliases, maps/sets, and new
compiler-known runtime names remain out of scope.
## 1.0.0-beta.9 Collection Alias Unification And Generic Reservation
The `1.0.0-beta.9` release applies beta.8 concrete aliases inside the current
source-authored collection/value-family facades. The public helper names and
runtime behavior remain concrete: current vectors, options, and results are
still concrete families, and the local aliases are erased before lowering.
This release also reserves the generic/map/set direction through diagnostics
and documentation only. It does not implement executable generics, maps, sets,
traits, inference, monomorphization, iterators, stable ABI/layout promises, or
a stable standard-library API freeze.
## 1.0.0-beta.10 Developer Experience API Discovery
The `1.0.0-beta.10` release upgrades the generated standard-library API
catalog from exported helper names to exact exported helper signatures. The
renderer verifies that every exported helper has a matching `(fn ...)` form,
normalizes module-local concrete aliases from the public signatures, omits
non-exported helpers and `(type ...)` aliases, and keeps the catalog generated
from `lib/std/*.slo`.
It also adds `glagol symbols <file.slo|project|workspace>` as an
editor-facing metadata command. The output is deterministic S-expression text
using `slovo.symbols` schema version `1.0.0-beta.10`; it includes module paths,
source spans/ranges, imports, exports, aliases, structs, enums, functions,
tests, and workspace package labels.
This release is tooling, documentation, and API-discovery work. It does not
add executable generics, maps, sets, new runtime helpers, new compiler-known
runtime names, ABI/layout guarantees, an LSP server, watch mode, or a stable
standard-library API freeze.
## 1.0.0-beta.11 Local Package API Documentation
The `1.0.0-beta.11` release extends the beta.10 API discovery lane to local
package and module documentation. `glagol doc <file|project|workspace> -o <dir>`
includes deterministic exported/public API sections for local modules and
workspace packages.
Those sections list exact exported function signatures, exported struct fields,
and exported enum variants with payload types. They omit non-exported
functions, structs, enums, tests, and aliases from the public API surface, and
they normalize module-local concrete aliases before rendering public types.
This remains beta API discovery. It does not freeze the Markdown schema, create
a stable stdlib/API compatibility freeze, add LSP/watch behavior, define
SARIF or daemon protocols, set diagnostics schema policy, implement executable
generics, maps, or sets, add re-exports, globs, or hierarchical modules, or
define package registry semantics.
## 1.0.0-beta.12 Concrete Vector Query And Prefix Parity
The `1.0.0-beta.12` release is a source-authored stdlib/helper parity update
for concrete vectors. It adds `count_of`, `starts_with`, `without_prefix`,
`ends_with`, and `without_suffix` to `std.vec_i64`, and adds `count_of` to
`std.vec_f64`, matching the already staged concrete helper style.
This release does not change the source language, runtime, compiler-known
`std.vec.*` names, ABI/layout contract, or performance contract. Generics,
maps/sets, iterators, mutable vectors, slice/view APIs, new runtime helper
names, stable stdlib API freeze, and broader collection abstractions remain
deferred.
## 1.0.0-beta.13 Diagnostic Catalog And Schema Policy
The `1.0.0-beta.13` release is a docs/tooling policy update for the existing
diagnostic surface. It adds
[`docs/language/DIAGNOSTICS.md`](docs/language/DIAGNOSTICS.md) as the beta
policy for `slovo.diagnostic` version `1`.
The policy documents the S-expression and JSON encodings, required and optional
machine fields, severity/source/range/related-span semantics, JSON-line
discipline, source-less diagnostics, artifact-manifest diagnostic metadata,
compatibility and migration classes, and the current code catalog covered by
the golden diagnostics contract.
This release does not change the source language, runtime, stdlib API,
diagnostic output shape, compiler CLI, LSP/watch behavior, SARIF/daemon
protocols, stable Markdown schema, or stable `1.0.0` diagnostics freeze.
## 1.0.0-beta.16 String Scanning And Token Boundary Foundation
The `1.0.0-beta.16` release adds the first explicit byte-oriented string
scanning and token-boundary helpers to the `std.string` source facade:
`byte_at_result`, `slice_result`, `starts_with`, and `ends_with`.
The helpers operate over the current NUL-terminated runtime string bytes before
the trailing NUL. `byte_at_result` and `slice_result` return `err 1` for
ordinary invalid indexes or ranges. `slice_result` returns a runtime-owned
string on success; allocation failure may trap with the existing string
allocation policy.
This release does not add Unicode scalar, grapheme, display-width, or locale
semantics; JSON parsing; object/array parsing; tokenizer APIs; a language
slice/view feature; mutable strings; stable ABI/layout; or a stable stdlib/API
freeze.
## 1.0.0-beta.15 Reserved Generic Collection Boundary Hardening And Collection Ledger
The `1.0.0-beta.15` release documents the current concrete collection and
value-family boundary. It adds
[`docs/language/COLLECTIONS.md`](docs/language/COLLECTIONS.md), which links to
the generated
[`docs/language/STDLIB_API.md`](docs/language/STDLIB_API.md) catalog instead
of duplicating generated helper counts.
The ledger inventories concrete vector, option, result, and related
option/result-returning facade surfaces; records the design pressure from
duplicated concrete vector/option/result helpers; and defines prerequisites
before executable generics, generic aliases, maps, sets, iterators, mutable
vectors, or slice/view APIs can be promoted.
Current unsupported diagnostics are documented as release boundaries, not as
new behavior. This release does not change the source language, runtime,
stdlib/API surface, diagnostic output shape/codes/schema, benchmark metadata
schema, compiler ABI/layout behavior, or performance claims, and it does not
create a stable stdlib/API freeze. It does reword affected reserved-boundary
diagnostic messages from beta.9-specific text to current-beta wording while
preserving diagnostic codes, schema, spans, expected/found values, hints, and
output shape.
## 1.0.0-beta.14 Benchmark Suite Catalog And Metadata Gate
The `1.0.0-beta.14` release documents the existing benchmark suite catalog as
beta-scoped metadata tooling. It adds
[`benchmarks/README.md`](benchmarks/README.md) with the current ten-suite
inventory, local evidence policy, suite-list commands, and exclusions.
The root suite catalog commands are:
```bash
python3 benchmarks/runner.py --suite-list
python3 benchmarks/runner.py --suite-list --json
```
The non-JSON listing is for local review. The JSON listing is beta tooling
metadata for local gates and adapters, not a stable public schema.
This release does not add benchmark kernels, publish timing numbers, define
performance thresholds, change the source language, runtime, stdlib/API
surface, diagnostic output, compiler ABI/layout behavior, or make cross-machine
performance claims.
## Documentation
- [Language Manifest](docs/language/MANIFEST.md)
- [Language Specification](docs/language/SPEC-v1.md)
- [Diagnostics Policy](docs/language/DIAGNOSTICS.md)
- [Local Package And Workspace Guide](docs/language/PACKAGES.md)
- [Standard Library API Catalog](docs/language/STDLIB_API.md)
- [Collection Ledger](docs/language/COLLECTIONS.md)
- [Benchmark Suite Catalog](benchmarks/README.md)
- [Compiler Manifest](docs/compiler/GLAGOL_COMPILER_MANIFEST.md)
- [Post-Beta Roadmap](docs/POST_BETA_ROADMAP.md)
- [Slovo Whitepaper](docs/papers/SLOVO_WHITEPAPER.md)
- [Glagol Whitepaper](docs/papers/GLAGOL_WHITEPAPER.md)
Generated PDFs live beside their Markdown sources in `docs/papers/`.
Regenerate them with `./scripts/render-doc-pdfs.sh` before documentation
releases.
## License
Slovo is licensed under either the MIT License or the Apache License, Version
2.0, at your option.