slovo/.llm/BETA_18_JSON_STRING_TOKEN_PARSING_FOUNDATION.md

1.8 KiB

1.0.0-beta.18 JSON String Token Parsing Foundation

Scope

Slovo-facing 1.0.0-beta.18 adds one narrow std.json facade name for JSON string token parsing:

  • parse_string_value_result ((token string)) -> (result string i32)

The helper is a thin source wrapper over the promoted compiler/runtime name std.json.parse_string_value_result. The existing JSON construction helpers from 1.0.0-beta.7 and primitive scalar parse helpers from 1.0.0-beta.17 remain intact.

Contract

parse_string_value_result consumes one already-isolated ASCII JSON string token. The token must start and end with quotes and must not include leading or trailing whitespace outside those quotes. Success returns ok decoded_text; ordinary parse failure returns err 1.

The token parser decodes the simple JSON escapes \", \\, \/, \b, \f, \n, \r, and \t. It rejects raw control bytes, bad escapes, unterminated strings, trailing bytes after the closing quote, raw non-ASCII, and all \uXXXX escapes for this slice.

Non-Scope

This is not full JSON parsing. It does not add object parsing, array parsing, recursive JsonValue, tokenizer APIs, generic parse APIs, whitespace-tolerant document parsing, streaming decoders or encoders, schema validation, Unicode escape decoding or normalization, embedded NUL policy, stable API freeze, stable ABI/layout, or performance claims.

Gate-Supporting Compiler Hardening

The beta18 release also includes a bounded glagol test stack hardening fix: test execution runs on a worker thread with a 16 MiB stack. This is not a new language feature. It keeps deep source-authored stdlib fixtures gateable through normal glagol test behavior instead of host process stack overflow, and is covered by the promotion gate's stdlib fixture test execution.