647 lines
36 KiB
Markdown
647 lines
36 KiB
Markdown
# Slovo Examples
|
|
|
|
Examples are split by current compiler support.
|
|
|
|
## Compiler-Supported Targets
|
|
|
|
Entries in this section are current compiler support under the matching
|
|
release notes. The current compiler-supported language baseline is
|
|
`1.0.0-beta`; `1.0.0-beta.1` adds tooling/install hardening without changing
|
|
these source-language fixtures. `1.0.0-beta.2` adds beta-scoped
|
|
runtime/resource foundation APIs. `1.0.0-beta.3` adds the generated stdlib API
|
|
catalog and the checked `projects/stdlib-composition/` example. The language
|
|
baseline absorbs the final exp-125 unsigned precursor scope alongside the
|
|
already promoted project/package, stdlib-source, collection, composite-data,
|
|
formatter, and diagnostics surface.
|
|
|
|
`supported/add.slo` is the current executable promotion fixture. Glagol can parse it,
|
|
lower it, type-check it, emit LLVM for it, and cover that output with an automated
|
|
test.
|
|
|
|
`supported/top-level-test.slo` is the current test-runner promotion fixture.
|
|
Glagol can parse it, lower it, type-check it, format it, inspect it, check tests,
|
|
run tests, keep normal LLVM emission free of test metadata, and cover those
|
|
behaviors with automated tests.
|
|
|
|
`supported/local-variables.slo` is the current local-binding promotion fixture.
|
|
Glagol can parse it, lower it, type-check it, format it, emit LLVM for local
|
|
storage, run local-using top-level tests, and cover local diagnostics with
|
|
automated tests. exp-112 later broadens that same fixture with direct
|
|
immutable `bool` locals over the already promoted bool-expression surface.
|
|
|
|
`supported/if.slo` is the current value-producing conditional promotion
|
|
fixture. Glagol can parse it, lower it, type-check it, format it, emit LLVM
|
|
branch/merge blocks, run if-using top-level tests, and cover conditional
|
|
diagnostics with automated tests.
|
|
|
|
`supported/while.slo` is the current first-pass loop promotion fixture. Glagol
|
|
can parse it, lower it, type-check it, format it, emit LLVM loop blocks, run
|
|
loop-using top-level tests, and cover loop diagnostics with automated tests.
|
|
|
|
`supported/struct.slo` is the current first-pass struct promotion fixture.
|
|
Glagol can parse it, lower it, type-check it, format it, emit LLVM for
|
|
immediate constructor field access, run struct-using top-level tests, and cover
|
|
struct diagnostics with automated tests.
|
|
|
|
`supported/struct-value-flow.slo` is the first v1 struct value-flow promotion
|
|
fixture. Glagol can parse it, lower it, type-check it, format it, emit LLVM for
|
|
immutable struct locals, struct parameters, struct returns, calls returning
|
|
structs, and field access through stored struct values.
|
|
|
|
`supported/array.slo` is the current first-pass array/indexing promotion
|
|
fixture. Glagol can parse it, lower it, type-check it, format it, emit LLVM for
|
|
immediate constructor indexing and immutable array local indexing, run
|
|
array-using top-level tests, and cover array diagnostics with automated tests.
|
|
|
|
`supported/array-value-flow.slo` is the first v1 array value-flow and
|
|
dynamic-indexing promotion fixture. Glagol can parse it, lower it, type-check
|
|
it, format it, emit LLVM for immutable array locals initialized from matching
|
|
array-valued expressions, fixed `i32` array parameters, returns, calls
|
|
returning arrays, and runtime-checked dynamic indexing, and run array
|
|
value-flow top-level tests.
|
|
|
|
`supported/array-direct-scalars.slo` broadens the fixed-array fixture surface
|
|
from `i32` only to direct scalar element families `i32`, `i64`, `f64`, and
|
|
`bool`. It keeps positive lengths only, immutable locals only, and checked
|
|
literal indexing only.
|
|
|
|
`supported/array-direct-scalars-value-flow.slo` broadens the array value-flow
|
|
fixture surface to the same direct scalar array family. It keeps immutable
|
|
array locals, parameters, returns, calls returning arrays, and runtime-checked
|
|
dynamic indexing, while keeping index expressions `i32` only.
|
|
|
|
`supported/array-string.slo` broadens the fixed-array fixture surface with one
|
|
concrete `string` element lane. It keeps positive lengths only, immutable
|
|
locals only, and checked literal indexing only.
|
|
|
|
`supported/array-string-value-flow.slo` broadens the array value-flow fixture
|
|
surface to the same `string` array lane. It keeps immutable array locals,
|
|
parameters, returns, calls returning arrays, and runtime-checked dynamic
|
|
indexing, while keeping index expressions `i32` only.
|
|
|
|
`supported/option-result.slo` is the current first-pass option/result
|
|
constructor promotion fixture. Glagol can parse it, lower it, type-check it,
|
|
format it, emit LLVM for direct constructor-return functions, and cover
|
|
option/result diagnostics with automated tests.
|
|
|
|
`supported/option-result-flow.slo` is the first v1 option/result value-flow
|
|
promotion fixture. Glagol can parse it, lower it, type-check it, format it,
|
|
emit LLVM for immutable option/result locals, option/result parameters, calls
|
|
returning option/result values, and tag observation with `is_some`, `is_none`,
|
|
`is_ok`, and `is_err`.
|
|
|
|
`supported/option-result-payload.slo` is the first v1 option/result
|
|
payload-access promotion fixture. Glagol can parse it, lower it, type-check it,
|
|
format it, emit LLVM for `unwrap_some`, `unwrap_ok`, and `unwrap_err`, runtime
|
|
trap on mismatched tags, and verify that tag checks happen before payload
|
|
access.
|
|
|
|
`supported/option-result-match.slo` is the v1.4 option/result match promotion
|
|
fixture. Glagol can parse it, lower it, type-check it, format it, emit LLVM for
|
|
source-level `match` over `(option i32)` and `(result i32 i32)`, enforce
|
|
exhaustive arms, bind immutable arm payloads, type-check common arm result
|
|
types, and cover match diagnostics with automated tests.
|
|
|
|
`supported/string-print.slo` is the first runtime string promotion fixture.
|
|
Glagol can parse it, lower it, type-check it, format it, emit LLVM for
|
|
immutable compiler-emitted NUL-terminated string literal storage, call the
|
|
legacy `print_string` runtime compatibility alias, and verify that the decoded
|
|
literal is printed with a trailing newline.
|
|
|
|
`supported/string-value-flow.slo` is the v1.2 immutable string value-flow
|
|
promotion fixture. Glagol can parse it, lower it, type-check it, format it,
|
|
emit LLVM for string locals, parameters, returns, calls returning strings,
|
|
string equality, and string byte length with `string_len`, and run top-level
|
|
tests using string equality and length comparisons.
|
|
|
|
`supported/print-bool.slo` is the v1.2 bool-printing promotion fixture. Glagol
|
|
can parse it, lower it, type-check it, format it, emit LLVM for the legacy
|
|
`print_bool` runtime compatibility alias, and verify `true` / `false` output
|
|
with trailing newlines.
|
|
|
|
`supported/standard-runtime.slo` is the v1.5 standard-runtime alpha promotion
|
|
fixture. Glagol can parse it, lower it, type-check it, format it, emit LLVM for
|
|
compiler-known `std.io.print_i32`, `std.io.print_string`, `std.io.print_bool`,
|
|
and `std.string.len` calls, preserve legacy print and string-length aliases,
|
|
and reject unknown or unpromoted `std.*` calls with structured diagnostics.
|
|
|
|
`supported/owned-string-concat.slo` is the exp-1 owned-runtime-string
|
|
compiler-supported fixture. The surface is compiler-known `std.string.concat`
|
|
with signature `(string, string) -> string`, producing an immutable
|
|
runtime-owned `string` usable by existing string equality, `std.string.len`,
|
|
`std.io.print_string`, string locals, parameters, returns, and calls.
|
|
|
|
`supported/vec-i32.slo` is the exp-2 collections alpha compiler-supported
|
|
fixture. It covers one concrete `(vec i32)` type,
|
|
`std.vec.i32.empty`, `std.vec.i32.append`, `std.vec.i32.len`,
|
|
`std.vec.i32.index`, vector equality, immutable locals, parameters, returns,
|
|
calls, and top-level tests.
|
|
|
|
`supported/vec-i64.slo` is the exp-94 concrete `(vec i64)` baseline
|
|
compiler-supported fixture. It covers `std.vec.i64.empty`,
|
|
`std.vec.i64.append`, `std.vec.i64.len`, `std.vec.i64.index`, vector
|
|
equality, append immutability, immutable locals, parameters, returns, calls,
|
|
and top-level tests.
|
|
|
|
`supported/host-io.slo` is the exp-3 standard IO and host environment
|
|
compiler-supported fixture. It covers `std.io.eprint`, `std.process.argc`,
|
|
`std.process.arg`,
|
|
`std.env.get`, `std.fs.read_text`, and `std.fs.write_text` using the
|
|
stage-specific trap/status behavior.
|
|
|
|
`supported/time-sleep.slo` is the exp-8 host time and sleep alpha conformance
|
|
fixture added by the exp-14 alignment release. It covers
|
|
`std.time.monotonic_ms: () -> i32`, `std.time.sleep_ms: (i32) -> unit`,
|
|
non-negative/structural monotonic-time checks, and deterministic `sleep_ms 0`
|
|
behavior. It makes no positive-duration timing assertion.
|
|
|
|
`supported/enum-basic.slo` is the exp-4 user enum fixture. It covers a
|
|
payloadless enum declaration, zero-argument qualified constructors,
|
|
same-enum equality, immutable local/parameter/return/call flow, exhaustive
|
|
payloadless enum `match`, and top-level tests.
|
|
|
|
`supported/enum-payload-i32.slo` is the exp-16 unary i32 enum payload fixture.
|
|
It covers an enum declaration mixing payloadless and unary `i32` payload
|
|
variants, qualified payload constructors, payload `match` arms with immutable
|
|
arm-local bindings, immutable local/parameter/return/call flow, same-enum
|
|
tag-plus-payload equality, top-level tests, and `main`.
|
|
|
|
`supported/enum-struct-fields.slo` is the exp-18 enum struct field fixture. It
|
|
covers struct field declarations using current enum type names directly,
|
|
struct construction with payloadless and unary `i32` enum field values, field
|
|
access returning enum values, same-enum equality on field access, exhaustive
|
|
enum `match` on field access, immutable local/parameter/return/call flow,
|
|
top-level tests, and `main`.
|
|
|
|
`supported/primitive-struct-fields.slo` is the exp-19 primitive struct field
|
|
fixture. It covers direct `i32`, `bool`, and immutable `string` struct fields,
|
|
construction, field access, immutable local/parameter/return/call flow, a bool
|
|
field in a predicate and test, string field equality, `std.string.len`,
|
|
top-level tests, and `main`.
|
|
|
|
`supported/local-variables.slo` is also the exp-112 immutable bool locals
|
|
fixture. It now covers direct immutable `bool` locals declared with `let`,
|
|
initialized from already promoted bool literals, parameters, and calls
|
|
returning bool, with local references feeding existing predicate, return,
|
|
call, top-level test, and `main` positions.
|
|
|
|
`supported/f64-numeric-primitive.slo` is the exp-20 f64 numeric primitive
|
|
fixture. It covers direct `f64` parameters, returns, immutable locals, calls,
|
|
decimal literals, same-type `f64` arithmetic/comparison, `std.io.print_f64`,
|
|
top-level tests, and `main` returning `i32`.
|
|
|
|
`supported/i64-numeric-primitive.slo` is the exp-21 i64 numeric primitive
|
|
fixture. It covers direct `i64` parameters, returns, immutable locals, calls,
|
|
explicit signed decimal `i64` literal atoms, same-type `i64`
|
|
arithmetic/comparison, `std.io.print_i64`, top-level tests, and `main`
|
|
returning `i32`.
|
|
|
|
`supported/numeric-widening-conversions.slo` is the exp-22 numeric widening
|
|
conversions alpha fixture. It covers exactly three explicit standard-runtime
|
|
calls: `std.num.i32_to_i64 : (i32) -> i64`,
|
|
`std.num.i32_to_f64 : (i32) -> f64`, and
|
|
`std.num.i64_to_f64 : (i64) -> f64`, with converted values feeding same-type
|
|
arithmetic/comparison, top-level tests, and `main` returning `i32`.
|
|
|
|
`supported/checked-i64-to-i32-conversion.slo` is the exp-23 checked
|
|
i64-to-i32 conversion alpha fixture. It covers exactly one checked narrowing
|
|
standard-runtime call,
|
|
`std.num.i64_to_i32_result : (i64) -> (result i32 i32)`, with low/high
|
|
signed `i32` bounds and an in-range negative value returning `ok`, out-of-range
|
|
values returning `err 1`, existing `std.result.*` helpers, top-level tests,
|
|
and `main` returning `i32`.
|
|
|
|
`supported/integer-to-string.slo` is the exp-24 integer to string alpha
|
|
fixture. It covers exactly two integer formatting standard-runtime calls,
|
|
`std.num.i32_to_string : (i32) -> string` and
|
|
`std.num.i64_to_string : (i64) -> string`, with decimal signed ASCII output
|
|
for `i32` zero/negative/high values and `i64` low/high/beyond-`i32` values,
|
|
existing string equality, `std.string.len`, `std.io.print_string`, top-level
|
|
tests, and `main` returning `i32`.
|
|
|
|
`supported/string-parse-i64-result.slo` is the exp-25 string parse i64 result
|
|
alpha fixture. It covers exactly one string parsing standard-runtime call,
|
|
`std.string.parse_i64_result : (string) -> (result i64 i32)`, with complete
|
|
non-empty ASCII signed decimal input, `ok` results for zero, a negative value,
|
|
and signed `i64` low/high bounds, `err 1` for empty, leading-plus, and
|
|
out-of-range input, existing result observation/extraction forms,
|
|
`std.num.i64_to_string` roundtrips, top-level tests, and `main` returning
|
|
`i32`.
|
|
|
|
`supported/f64-to-string.slo` is the exp-26 f64 to string alpha fixture. It
|
|
promotes exactly `std.num.f64_to_string : (f64) -> string`, with finite
|
|
decimal ASCII text for promoted finite `f64` fixture values.
|
|
|
|
`supported/f64-to-i32-result.slo` is the exp-27 checked f64 to i32 result
|
|
alpha fixture. It promotes exactly
|
|
`std.num.f64_to_i32_result : (f64) -> (result i32 i32)`, returning `ok value`
|
|
only for finite, exactly integral inputs inside the signed `i32` range and
|
|
`err 1` for non-finite, fractional, or out-of-range input.
|
|
|
|
`supported/string-parse-f64-result.slo` is the exp-28 string parse f64 result
|
|
alpha fixture. It promotes exactly
|
|
`std.string.parse_f64_result : (string) -> (result f64 i32)`, returning
|
|
`ok value` for complete finite ASCII decimal `f64` text and `err 1` for
|
|
ordinary parse failure, non-finite text, trailing or leading unsupported
|
|
characters, or out-of-domain input.
|
|
|
|
`supported/numeric-struct-fields.slo` is the exp-29 numeric struct fields
|
|
alpha fixture. It promotes direct immutable struct field declarations whose
|
|
field types are exactly `i64` or finite `f64`, alongside already supported
|
|
direct `i32`, `bool`, immutable `string`, and current enum fields. It covers
|
|
constructors, immutable local/parameter/return/call flow, field access,
|
|
same-type arithmetic/comparison after field access, existing numeric
|
|
print/format helpers, top-level tests, and `main`.
|
|
|
|
`formatter/std-source-layout-alpha.slo` is the exp-30 standard library source
|
|
layout alpha formatter fixture. It demonstrates the current helper shape while
|
|
the source layout itself lives under `std/`; it does not claim repo-root `std`
|
|
import/search support.
|
|
|
|
`supported/f64-to-i64-result.slo` is the exp-31 checked f64 to i64 result
|
|
alpha fixture. It promotes exactly
|
|
`std.num.f64_to_i64_result : (f64) -> (result i64 i32)`, returning `ok value`
|
|
only for finite, exactly integral inputs inside the signed `i64` range and
|
|
`err 1` for non-finite, fractional, or out-of-range input. It uses a
|
|
formatter-stable conservative out-of-range fixture value,
|
|
`9223372036854776000.0`; the accepted exact `9223372036854775808.0` spelling
|
|
formats to that value. Detailed edge behavior near the `f64`/`i64` limits is
|
|
implementation-owned by Glagol tests.
|
|
|
|
## Current Slovo-Side Beta Baseline
|
|
|
|
The current Slovo-side beta baseline includes the final exp-125 unsigned
|
|
numeric and stdlib breadth scope. These files are now current
|
|
compiler-supported targets with matching Glagol coverage:
|
|
|
|
- `supported/u32-numeric-primitive.slo`
|
|
- `supported/u64-numeric-primitive.slo`
|
|
- `supported/unsigned-integer-to-string.slo`
|
|
- `supported/string-parse-u32-result.slo`
|
|
- `supported/string-parse-u64-result.slo`
|
|
- widened explicit import projects under `projects/std-import-string/`,
|
|
`projects/std-import-num/`, `projects/std-import-io/`,
|
|
`projects/std-import-env/`, `projects/std-import-fs/`,
|
|
`projects/std-import-process/`, `projects/std-import-cli/`,
|
|
`projects/std-import-result/`, and `projects/std-import-option/`
|
|
- `projects/stdlib-composition/`, a realistic command-line example that uses
|
|
explicit `std.fs`, `std.string`, `std.math`, and `std.io` imports together
|
|
for file write/read, parse, compute, cleanup, and hosted `glagol run` output
|
|
|
|
`supported/unsafe.slo` is the current lexical unsafe promotion fixture. Glagol
|
|
can parse it, lower it, type-check it, format it, emit LLVM for safe forms
|
|
inside the block, and cover unsafe-required diagnostics for raw unsafe
|
|
operation heads with automated tests.
|
|
|
|
`supported/random.slo` is the exp-11 basic randomness alpha release fixture.
|
|
It covers only `std.random.i32: () -> i32` and a non-negative result check.
|
|
|
|
`supported/stdin-result.slo` is the exp-12 standard input result alpha release
|
|
fixture. It covers only
|
|
`std.io.read_stdin_result: () -> (result string i32)`, existing
|
|
`(result string i32)` observers, unwrap, and `match`, with deterministic
|
|
test-runner `ok` behavior.
|
|
|
|
`supported/string-parse-i32-result.slo` is the exp-13 string parse i32 result
|
|
alpha release fixture. It covers only
|
|
`std.string.parse_i32_result: (string) -> (result i32 i32)`, existing
|
|
`(result i32 i32)` observers, unwrap, and `match`, and structural composition
|
|
with `std.io.read_stdin_result` without assuming a particular stdin payload.
|
|
|
|
`supported/result-helpers.slo` is the exp-15 result helper standard names alpha
|
|
fixture. It covers `std.result.is_ok`, `std.result.is_err`,
|
|
`std.result.unwrap_ok`, and `std.result.unwrap_err` for only
|
|
`(result i32 i32)` and `(result string i32)`.
|
|
|
|
Supported examples are part of the current compiler contract. The supported
|
|
subset is only the syntax and behavior exercised by the released fixture set:
|
|
module,
|
|
top-level functions, top-level tests, top-level `i32` structs, `i32` parameters
|
|
and returns, direct `(option i32)`, `(option i64)`, and `(result i32 i32)`
|
|
constructor returns,
|
|
integer literals, parameter references, binary `+`, equality
|
|
comparison `=`, function calls, legacy compiler/runtime compatibility alias
|
|
`print_i32`, local `i32` bindings with `let` and `var`, immutable
|
|
`(array T N)` locals with direct array constructors when `T` is `i32`, `i64`,
|
|
`f64`, or `bool`, assignment to mutable locals with `set`, ordering comparison
|
|
`<` as a bool-producing condition, value-producing `if`,
|
|
first-pass `while`, first-pass struct construction and immediate field access,
|
|
first v1 struct value flow through immutable locals, parameters, returns, and
|
|
stored field access,
|
|
fixed direct scalar array constructors and literal indexing,
|
|
fixed direct scalar array value flow through immutable array locals initialized
|
|
from matching array-valued expressions, fixed array parameters, returns, calls
|
|
returning arrays, and runtime-checked dynamic indexing with `i32` index
|
|
expressions,
|
|
first-pass `(some i32 value)`, `(none i32)`, `(some i64 value)`,
|
|
`(none i64)`, `(ok i32 i32 value)`, and `(err i32 i32 value)` constructors as
|
|
direct function returns,
|
|
first v1 option/result value flow through immutable locals, parameters, calls,
|
|
and tag observation,
|
|
first v1 trap-based concrete option/result payload extraction with
|
|
`unwrap_some`, `unwrap_ok`, and `unwrap_err`,
|
|
v1.4 source-level `match` for `(option i32)`, `(option i64)`, and
|
|
`(result i32 i32)` values, with exhaustive arms, immutable arm-scoped payload
|
|
bindings, one-or-more expression arm bodies, and common arm result types,
|
|
first runtime string slice through immutable source string literals passed
|
|
directly to legacy compiler/runtime compatibility alias `print_string`,
|
|
v1.2 immutable string value flow through `let` locals, parameters, returns,
|
|
calls returning strings, string equality, string byte length through
|
|
`string_len`, top-level tests using string equality, and legacy
|
|
compiler/runtime compatibility alias `print_bool`,
|
|
v1.5 compiler-known standard-runtime names `std.io.print_i32`,
|
|
`std.io.print_string`, `std.io.print_bool`, and `std.string.len`, with legacy
|
|
`print_i32`, `print_string`, `print_bool`, and `string_len` retained as
|
|
compatibility aliases,
|
|
exp-1 `std.string.concat` fixture for immutable runtime-owned strings,
|
|
exp-2 `(vec i32)` values with empty/append/len/index/equality,
|
|
exp-3 host IO calls,
|
|
exp-4 payloadless enum forms,
|
|
exp-5 local package/workspace graph hygiene,
|
|
exp-6 C FFI scalar imports behind lexical `unsafe`,
|
|
exp-8 host time/sleep names with only `sleep_ms 0` and structural/
|
|
non-negative `monotonic_ms` checks,
|
|
the exp-11 `std.random.i32` release,
|
|
the exp-12 `std.io.read_stdin_result` release,
|
|
the exp-13 `std.string.parse_i32_result` release,
|
|
the exp-15 preferred `std.result.*` helper names for the already supported
|
|
`(result i32 i32)` and `(result string i32)` families, with legacy
|
|
unqualified result helpers retained as compatibility syntax,
|
|
the exp-16 unary `i32` enum payload release,
|
|
the exp-18 direct enum struct field release,
|
|
the exp-19 direct primitive struct field release,
|
|
the exp-112 immutable bool locals release,
|
|
the exp-20 direct f64 numeric primitive release,
|
|
the exp-21 direct i64 numeric primitive release,
|
|
the exp-22 numeric widening conversion release,
|
|
the exp-23 checked i64-to-i32 conversion release,
|
|
the exp-24 integer to string release,
|
|
the exp-25 string parse i64 result release,
|
|
the exp-26 f64 to string release,
|
|
the exp-27 checked f64-to-i32 result release,
|
|
the exp-28 string parse f64 result release,
|
|
the exp-31 checked f64-to-i64 result release,
|
|
lexical `unsafe` expression blocks containing only otherwise supported safe v0 forms,
|
|
and final-expression returns.
|
|
|
|
## Compatibility
|
|
|
|
Frozen v0 compatibility fixtures live under `compat/v0/`.
|
|
`compat/v0/supported/` preserves the v0 supported program fixtures, and
|
|
`compat/v0/formatter/` preserves the v0 formatter fixtures. They are not the
|
|
place for new v1 promotion work.
|
|
|
|
Compatibility fixtures change only through the migration process in
|
|
`../MIGRATION_POLICY.md`. Ordinary v1 additions belong in `supported/` and
|
|
`formatter/`.
|
|
|
|
## Projects
|
|
|
|
`projects/basic/` is the minimal v1.3 project-mode fixture. It contains a
|
|
`slovo.toml` manifest, a flat `src` source root, one exported local module, one
|
|
explicit import, top-level tests, and an entry `main` function.
|
|
|
|
`projects/enum-imports/` is the exp-17 project enum import fixture. It exports
|
|
an enum from one module, imports that enum type into another module, and covers
|
|
payloadless and unary `i32` payload constructors, immutable locals,
|
|
signatures, calls/returns, same-enum equality, exhaustive enum `match`,
|
|
top-level tests, and `main`. Matching Glagol exp-17 gates are required before
|
|
broader compiler-support claims.
|
|
|
|
Project fixtures are local module fixtures only. They are not package-manager,
|
|
dependency, workspace, registry, generated-code, ABI, or incremental-build
|
|
fixtures.
|
|
|
|
## Workspaces
|
|
|
|
`workspaces/exp-5-local/` is the minimal exp-5 local workspace fixture.
|
|
It contains one workspace manifest, two local package manifests, one local path
|
|
dependency, one package-qualified import, and one exported cross-package
|
|
function.
|
|
|
|
This fixture is experimental compiler-supported after matching Glagol exp-5
|
|
gates passed. It is not a remote registry, version solving, lockfile,
|
|
build-script, generated-code, published-package, semver, ABI, macro,
|
|
package-generic, or package re-export fixture.
|
|
|
|
## FFI
|
|
|
|
`ffi/exp-6-c-add/` is the minimal exp-6 C FFI scalar imports alpha fixture. It
|
|
contains one top-level imported C function declaration, a local C companion
|
|
implementing `c_add`, and a safe Slovo wrapper whose imported C call is visibly
|
|
inside lexical `(unsafe ...)`.
|
|
|
|
This fixture is current experimental compiler-supported coverage after
|
|
matching Slovo and Glagol exp-6 gates. It is not a pointer, allocation,
|
|
deallocation, raw memory, ownership/lifetime, C export, generated-header,
|
|
generated-library, broad linker, stable ABI, or stable layout fixture.
|
|
|
|
## Formatter
|
|
|
|
Files in `formatter/` define canonical layout for the current strict supported
|
|
syntax. They do not add language features and they are not executable
|
|
promotion fixtures unless they are also present under `supported/`.
|
|
|
|
Formatter examples may use only the supported forms listed above, plus line
|
|
comments. Unsupported design-target forms must stay out of formatter fixtures
|
|
until their formatter behavior and full compiler contract are implemented.
|
|
Top-level `test` is covered by `formatter/top-level-test.slo`.
|
|
Value-producing `if` is covered by `formatter/if.slo`.
|
|
Local declarations and assignment are covered by
|
|
`formatter/local-variables.slo`. First-pass `while` is covered by
|
|
`formatter/while.slo`. First-pass structs are covered by
|
|
`formatter/struct.slo`. First v1 struct value flow is covered by
|
|
`formatter/struct-value-flow.slo`. First-pass array constructors, immutable
|
|
array locals, and literal indexing are covered by `formatter/array.slo` and
|
|
the widened direct scalar fixture `formatter/array-direct-scalars.slo`. First
|
|
v1 array value flow and dynamic indexing are covered by
|
|
`formatter/array-value-flow.slo` and the widened direct scalar fixture
|
|
`formatter/array-direct-scalars-value-flow.slo`. The widened fixed string
|
|
array constructor and literal-indexing lane is covered by
|
|
`formatter/array-string.slo`. The widened fixed string array value-flow and
|
|
dynamic-indexing lane is covered by `formatter/array-string-value-flow.slo`.
|
|
First-pass option/result constructors are covered by
|
|
`formatter/option-result.slo`. First v1 option/result value flow is covered by
|
|
`formatter/option-result-flow.slo`. First v1 option/result payload access is
|
|
covered by `formatter/option-result-payload.slo`. v1.4 option/result match is
|
|
covered by `formatter/option-result-match.slo`. Lexical unsafe blocks are
|
|
covered by `formatter/unsafe.slo`. First runtime string printing is covered by
|
|
`formatter/string-print.slo`. v1.2 string value flow is covered by
|
|
`formatter/string-value-flow.slo`. v1.2 bool printing is covered by
|
|
`formatter/print-bool.slo`. v1.5 standard-runtime names are covered by
|
|
`formatter/standard-runtime.slo`. exp-1 owned string concatenation is covered
|
|
by `formatter/owned-string-concat.slo`. exp-2 vectors are covered by
|
|
`formatter/vec-i32.slo`. exp-3 host IO formatting is covered by
|
|
`formatter/host-io.slo`. exp-4 enum formatting is covered by
|
|
`formatter/enum-basic.slo`. exp-16 unary `i32` enum payload formatting is
|
|
covered by `formatter/enum-payload-i32.slo`. exp-18 direct enum struct field
|
|
formatting is covered by `formatter/enum-struct-fields.slo`. exp-19 direct
|
|
primitive struct field formatting is covered by
|
|
`formatter/primitive-struct-fields.slo`. exp-112 immutable bool locals
|
|
formatting is covered by `formatter/local-variables.slo`. exp-20 f64 numeric
|
|
primitive formatting is covered by `formatter/f64-numeric-primitive.slo`. exp-21 i64
|
|
numeric primitive formatting is covered by
|
|
`formatter/i64-numeric-primitive.slo`. exp-22 numeric widening conversion
|
|
formatting is covered by `formatter/numeric-widening-conversions.slo`. exp-23
|
|
checked i64-to-i32 conversion formatting is covered by
|
|
`formatter/checked-i64-to-i32-conversion.slo`. exp-24 integer to string
|
|
formatting is covered by `formatter/integer-to-string.slo`. exp-17 does not
|
|
add a project
|
|
formatter fixture because this directory contains single-file formatter
|
|
fixtures, not whole project directories. The exp-12 standard input result
|
|
alpha is covered by `formatter/stdin-result.slo`. The exp-13 string
|
|
parse i32 result alpha is covered by
|
|
`formatter/string-parse-i32-result.slo`. The exp-25 string parse i64 result
|
|
alpha is covered by `formatter/string-parse-i64-result.slo`. The exp-26 f64
|
|
to string alpha is covered by `formatter/f64-to-string.slo`. The exp-27
|
|
checked f64-to-i32 result alpha is covered by
|
|
`formatter/f64-to-i32-result.slo`. The exp-28 string parse f64 result alpha
|
|
is covered by `formatter/string-parse-f64-result.slo`. The exp-29 numeric
|
|
struct fields alpha is covered by `formatter/numeric-struct-fields.slo`. The
|
|
exp-30 standard library source layout alpha is covered conservatively by
|
|
`formatter/std-source-layout-alpha.slo`. The exp-31 checked f64-to-i64 result
|
|
alpha is covered by `formatter/f64-to-i64-result.slo`. The
|
|
exp-15 result helper standard names
|
|
alpha is covered by
|
|
`formatter/result-helpers.slo`.
|
|
|
|
## Design/Speculative
|
|
|
|
Files in `speculative/` are language-design targets. They document intended Slovo
|
|
forms, but they are not current Glagol executable fixtures until each form has
|
|
parser/lowerer support, checker behavior, diagnostics, formatter behavior, LLVM
|
|
behavior or explicit unsupported diagnostics, and automated tests.
|
|
|
|
Speculative examples may use forms that Glagol partially recognizes. Partial
|
|
recognition is not support; these files stay outside the compiler contract until
|
|
the strict support rule is satisfied.
|
|
|
|
`speculative/point.slo` tracks follow-up struct behavior beyond v1 struct value
|
|
flow, including mutation and broader layout/ABI questions. The first-pass
|
|
struct contract is promoted through `supported/struct.slo`; the first v1
|
|
struct value-flow contract is promoted through `supported/struct-value-flow.slo`.
|
|
|
|
`speculative/array-index.slo` is retained as a non-contract array sketch. The
|
|
promoted v1 array value-flow forms live in `supported/array-value-flow.slo`
|
|
and the widened direct scalar fixtures `supported/array-direct-scalars.slo`
|
|
and `supported/array-direct-scalars-value-flow.slo`, plus the fixed string
|
|
fixtures `supported/array-string.slo` and
|
|
`supported/array-string-value-flow.slo`; mutation, slices, other unsupported
|
|
element types, nested arrays, equality, printing, unchecked indexing, and
|
|
layout/ABI questions remain follow-up work.
|
|
|
|
`speculative/option-result.slo` tracks follow-up option/result behavior beyond
|
|
the current promoted constructor, value-flow, tag-observation, and explicit
|
|
`i32` payload-access and v1.4 match fixtures, including mapping, equality,
|
|
printing, string payloads, non-`i32` payloads, generic payloads, nested
|
|
option/result values, arrays or structs containing option/results,
|
|
payload ADTs, and user-catchable exceptions.
|
|
|
|
Runtime string printing is promoted through `supported/string-print.slo`.
|
|
Immutable string value flow, string equality, and string byte length are
|
|
promoted through `supported/string-value-flow.slo`. Mutable string locals,
|
|
string assignment, string ordering, strings inside arrays, options, or
|
|
results, string containers beyond exp-19 direct struct fields, string slices,
|
|
concatenation beyond exp-1 `std.string.concat`,
|
|
indexing, ownership annotations, and user-defined string runtime bindings
|
|
remain follow-up design work. `print_unit` remains
|
|
unsupported because `unit` is still an internal builtin result type rather than
|
|
a user-visible value. v1.5 standard-runtime names are promoted only for
|
|
existing print and string-length behavior. `std.io.print_unit`, host IO beyond
|
|
the exp-3 slice and exp-12 stdin-result slice, networking, async IO, binary
|
|
file APIs, directory
|
|
traversal, terminal control, platform abstraction, general host error ADTs,
|
|
`result string Error`, package interaction, stdin APIs beyond the exp-12
|
|
result slice, parsing beyond exp-13 `std.string.parse_i32_result`, exp-25
|
|
`std.string.parse_i64_result`, and exp-28
|
|
`std.string.parse_f64_result`, result helper payload families beyond the
|
|
explicitly listed `(result i32 i32)`, `(result i64 i32)`,
|
|
`(result string i32)`, and exp-28 returned `(result f64 i32)` families,
|
|
tokenizer/scanner APIs, parsing bools/strings/bytes,
|
|
whitespace/locale/base-prefix/underscore/plus-sign parsing, Unicode digit
|
|
parsing, parse error messages or richer codes, randomness, time, generic
|
|
vectors, vector element types other than `i32`,
|
|
vector mutation, vector `var` or `set`, vector literals beyond empty/append
|
|
construction, `push`, nested vectors, vectors in arrays, structs, options, or
|
|
results, iterators, slices, maps, sets, user-visible vector deallocation,
|
|
stable vector ABI/layout/helper symbols, allocation, user-defined standard
|
|
modules, imports/packages, overloading, generic APIs, Unicode length
|
|
semantics, and ABI/layout promises remain follow-up design work. exp-2 adds
|
|
only `(vec i32)` with
|
|
`std.vec.i32.empty`, `std.vec.i32.append`, `std.vec.i32.len`,
|
|
`std.vec.i32.index`, and vector equality. exp-3 adds only `std.io.eprint`,
|
|
`std.process.argc`, `std.process.arg`, `std.env.get`, `std.fs.read_text`, and
|
|
`std.fs.write_text`. exp-4 adds only payloadless user-defined enums with
|
|
qualified zero-argument constructors, same-enum equality, immutable value flow,
|
|
and exhaustive payloadless enum `match`. exp-16 adds only unary `i32` enum
|
|
payload variants, exp-17 adds only explicit project/workspace import/export
|
|
of current enum type names, and exp-18 adds only direct enum-typed struct
|
|
fields for the current enum surface. exp-19 adds only direct `bool` and
|
|
immutable `string` struct fields alongside direct `i32` and exp-18 enum
|
|
fields. exp-112 adds only direct immutable `bool` locals over already
|
|
promoted bool expressions. exp-20 adds only direct `f64` value flow,
|
|
same-type `f64` arithmetic/comparison, and `std.io.print_f64`. `f32`,
|
|
wider/common integer
|
|
types beyond exp-21 direct `i64`, char/bytes/decimal, numeric casts, mixed
|
|
numeric arithmetic, f64/i64 collections, f64/i64 enum payloads, f64/i64 struct
|
|
fields, parse_f64, random floats or random `i64`, stable
|
|
ABI/layout, and beta maturity remain deferred. exp-21 adds only direct `i64`
|
|
value flow, explicit signed decimal `i64` literal atoms, same-type `i64`
|
|
arithmetic/comparison, and `std.io.print_i64`. exp-22 adds only explicit
|
|
standard-runtime widening calls `std.num.i32_to_i64 : (i32) -> i64`,
|
|
`std.num.i32_to_f64 : (i32) -> f64`, and
|
|
`std.num.i64_to_f64 : (i64) -> f64`. exp-23 adds only
|
|
`std.num.i64_to_i32_result : (i64) -> (result i32 i32)`; implicit promotion,
|
|
mixed numeric operators, other narrowing or checked conversions, cast syntax,
|
|
`std.num.cast`, `f64` conversions, `f32`, unsigned/narrower integer families,
|
|
numeric parse/format APIs beyond exp-24 integer-to-string, exp-25
|
|
`std.string.parse_i64_result`, exp-26 finite `std.num.f64_to_string`, and
|
|
exp-27 checked `std.num.f64_to_i32_result`,
|
|
stable ABI/layout, and beta maturity remain deferred. exp-24 adds only
|
|
`std.num.i32_to_string : (i32) -> string` and
|
|
`std.num.i64_to_string : (i64) -> string`; `f64` formatting, parse APIs,
|
|
locale/base/radix/grouping/padding controls, generic format/display traits,
|
|
implicit conversions, stable standard-library implementation source, stable
|
|
ABI/layout/ownership, and beta maturity remain deferred. exp-25 adds only
|
|
`std.string.parse_i64_result : (string) -> (result i64 i32)`; `f64` parse,
|
|
generic parse, whitespace/plus/underscore/radix/base/locale/Unicode parsing,
|
|
rich parse errors, stable ABI/layout/ownership, and beta maturity remain
|
|
deferred. exp-26 adds only `std.num.f64_to_string : (f64) -> string`; `f32`,
|
|
f64 parse, generic format/display/interpolation, precision controls, stable
|
|
NaN/infinity text, stable ABI/layout/ownership, and beta maturity remain
|
|
deferred. exp-27 adds only
|
|
`std.num.f64_to_i32_result : (f64) -> (result i32 i32)`; unchecked `f64` to
|
|
`i32`, casts or cast syntax, generic `cast_checked`, `f32`,
|
|
unsigned/narrower integer families, f64 parse, mixed numeric arithmetic,
|
|
numeric containers, stable ABI/layout/ownership, and beta maturity remain
|
|
deferred. exp-28 adds only
|
|
`std.string.parse_f64_result : (string) -> (result f64 i32)`; generic parse,
|
|
bool/string/bytes parse, locale parsing, Unicode digit parsing, underscores,
|
|
rich parse errors, stable helper ABI/layout/ownership, result genericity, f64
|
|
containers, mixed numeric arithmetic, and beta maturity remain deferred.
|
|
exp-29 adds only direct immutable `i64` and finite `f64` struct fields;
|
|
struct field mutation, nested structs, arrays/vectors/options/results as
|
|
fields, enum payload widening, numeric containers, `f32`, unsigned or
|
|
narrower integer families, mixed numeric arithmetic, implicit conversions,
|
|
new parse/format APIs, generic structs, methods, traits, stable ABI/layout/
|
|
ownership, manifest schema changes, FFI layout claims, and beta maturity
|
|
remain deferred. exp-31 adds only
|
|
`std.num.f64_to_i64_result : (f64) -> (result i64 i32)`; unchecked casts,
|
|
cast syntax, generic `cast_checked`, `f32`, unsigned/narrower integer
|
|
families, mixed numeric arithmetic, broad math, stable ABI/layout, manifest
|
|
schema changes, and beta maturity remain deferred.
|
|
Payloads beyond unary
|
|
`i32`,
|
|
generic enums,
|
|
generic functions, type aliases, traits/interfaces/protocols, methods, derives,
|
|
wildcard/rest patterns, guards, nested patterns, enum values in
|
|
arrays/options/results/vectors, enum values in nested structs, enum mutation, enum
|
|
printing/ordering/hash, reflection, explicit discriminants, unqualified
|
|
variant constructors, enum import behavior beyond exp-17 explicit local lists,
|
|
stable ABI/layout, and moving option/result to ordinary standard-library types
|
|
remain deferred.
|
|
|
|
`speculative/unsafe-memory.slo` tracks follow-up raw-memory behavior beyond the
|
|
current lexical unsafe block, including pointer locals, allocation,
|
|
deallocation, pointer load/store, and other unsafe operations.
|