Skip to content

Definitions and extensibility

L extends vocabulary through declarations, source actions, descriptors and native-backed definitions. Typed arguments and source ownership constrain each mechanism; arbitrary English is not executable.

Create introduces a supported value or lexical action. Define supplies a scalar, runtime value or native-backed definition. Describe associates an adjective with nominal targets and constructor/wrapper rules. Active/passive grammar and resolved ownership determine the declaration site.

Declarations retain tokens, formal identities, bindings, descriptor targets and source spans. Publication validates relationships before committing; expansion creates use-specific instances without mutating prototypes.

builtins/eng/core.l (lines 1–2)
Create "Start|-s|-ed|-ing|-er" for Building any App and then Running it.
Create "Execute|-s|-d|--ing|--or" for Starting any App and then Awaiting it.

Fragment. Source: builtins/eng/core.l (lines 1–2).

Example evidence

Implicit Start/Execute source definitions and their declared verb inflections; already loaded by the compiler, not user redeclarations. existing-witness-not-run. Evidence guide.

any App declares a typed argument; it refers to that argument. Start expands Build/Run; Execute expands Start/Await. Neither is a primitive instruction root.

Calls check argument count and nominal type. Coordinated operands expand the complete body for each operand in order. Definition-site references retain their bindings; actual arguments and diagnostics belong to the call. Expansion cycles reject rather than supplying runtime recursion.

Quoted labels list bar-separated forms. Nouns use root/plural/descriptive/active positions; verbs use root/active/passive/applicative/objective positions. One leading hyphen appends a suffix; additional hyphens remove trailing root bytes first. See lexical rules.

Start|-s|-ed|-ing|-er produces Start, Starts, Started, Starting and Starter. Execute|-s|-d|--ing|--or trims the final e for Executing/Executor. Grammatical roles can change while ownership remains canonical; inflection does not publish private helpers.

Descriptors bind nominal identities to ordered child-construction or wrapper rules. Same-named private declarations remain distinct; aliases preserve identity. Missing target constructors and recursive expansion reject.

demo/paragraphs/local-definitions.l
Use IO's Print from `io` as "Print".
"message" is `done`.
Create "Launch|-es|-ed|-ing" for Building any App and Running it and then Awaiting it.
"Compact" describes a Generic App with a New Main Service using any Process.
"message" is `First local`.
Create "First" as a New Compact App.
The App Prints message.
Launch First.
Define "result" as First's Output.
Show result.
Create "Launch|-es|-ed|-ing" for Building any App and Running it and then Awaiting it.
"Compact" describes a Generic App with a New Main Service using any Process.
"message" is `Second local`.
Create "Second" as a New Compact App.
The App Prints message.
Launch Second.
Define "result" as Second's Output.
Show result.
Show message.

Complete program. Source: demo/paragraphs/local-definitions.l.

Example evidence

Scoped action and descriptor definitions reuse source vocabulary. existing-witness-not-run. Evidence guide.

The two paragraphs own separate Launch actions, Compact descriptors and captured messages. New selects construction, Generic participates in source composition and Public controls visibility; none infers Rust lifetimes or generic arguments.

Main constructs a Function inside an Object inside a Service; Basic supplies that Main Service to an App. These rules define New Basic App.

builtins/eng/core.l (lines 3–5)
Define "Process|-es|-ive|-ing" as `<DEF>W^<@Definitions|Syllables@><DEF>`.
Define "Function|-s|-al|-ing" as `<DEF>FW{|Func{Key: <@Name|Text@>, Inputs: <@Inputs|Props@>, Outputs: <@Outputs|Texts@>}Func|}^(<@Process@>)<DEF>`.
Define any Function's "Return|-s|-ed|-ing|-er" to `<DEF>BOD^E{|Statement: ~return <@Statement@>;~|}<DEF>`.

Fragment. Source: builtins/eng/core.l (lines 3–5).

Example evidence

Canonical Process, Function and Function.Return definitions shared by source bodies and Object construction. existing-witness-not-run. Evidence guide.

Process composes ordered Syllables through W. Function supplies FW/Func metadata: Name, typed Inputs, output types and an instantiated Process. Source Function declarations use this selected definition too; Function-local Return binds its builtin member after checking source results.

builtins/eng/core.l (lines 9–12)
"Main" is a New Adjective describing any Service, Object, or Function.
It describes a Generic `main` Function of any Process with No Inputs and No Outputs.
It describes a Generic `main` Object with a New Objective Main Function using any Process.
It describes a Generic `main` Service with a New Main Object using any Process.

Fragment. Source: builtins/eng/core.l (lines 9–12).

Example evidence

Implicit Main adjective and its Function, Object, and Service construction rules; already loaded by the compiler. existing-witness-not-run. Evidence guide.

Each It describes refines Main. App construction selects its Service, Object and Function rules. Main supplies no inputs or outputs; ordinary Functions supply their declared signatures and bodies. A standalone Main Service remains structural; methods, overloads and variadic signatures are not introduced.

Source definitions use backtick Text with one complete outer <DEF>…<DEF> pair. Both markers are spelled <DEF>; neither is an XML closing tag. Interior/incomplete markers remain ordinary Text. Empty or nested definition bodies reject. The framing helper can inspect quoted/unquoted frames; explicit internal template parsing also accepts markerless interiors. Those internal interfaces do not remove source backticks.

cmd/l/test/runnable_service/probe.l (lines 1–3)
Define "Log|-s|-ged|-ging|-ger" to `<DEF>BOD^E{|Statement: ~std::io::Write::write_all(&mut std::io::stdout(), (<@Output|Thing@>).as_bytes()).unwrap();~|}<DEF>`.
Create "ProbeIO" as a Dictionary.
Create ProbeIO's "Print|-s|-ed|-ing|-er" for Processing a New Logger.

Fragment. Source: cmd/l/test/runnable_service/probe.l (lines 1–3).

Example evidence

Native-backed ProbeIO dictionary operation used by App bodies; this vocabulary fragment is not independently executable. existing-witness-not-run. Evidence guide.

Log defines a native body; ProbeIO.Print composes its Logger form. App-body callers supply Output. BOD^E integrates the Calculation, {|Statement: …|} supplies metadata and ~…~ encloses native statement text. See the native-definition guide for its caller.

A body may be one expression, a JSON string array representing a word, or an array of word arrays. Grouping survives instantiation. Quote, backslash and backtick escapes decode once; native escapes such as \n survive, and arguments are not decoded again.

<@Name|Type@> declares a typed slot; <@Name@> references an instantiated definition. Compatible repetitions share one ordered formal; conflicting declarations reject. Dotted labels follow L identifier rules, independently of Go/Rust keywords and native identifier validation.

Binding kindData
TextUnquoted scalar bytes, safely encoded for native use
NumberFinite binary64 with native f64 typing
TruthBoolean scalar
NullExplicit native display atom, not a null pointer
SyllableInstantiated expression
SyllablesOrdered expressions with preserved cardinality
PropsTyped native property records
TextsOrdered native type/output text collection
TypeNative type atom or selected source type declaration, retaining its dependency
AtomsOrdered scalar/name/reference arguments; never an executable body
LabelValidated result identifier, distinct from an assignment target
DefinitionInstantiated definition with identity and grouping

Native Thing slots accept Text, Number, Truth and Null without converting them to strings; this Log body requires Text for .as_bytes(). Ordinary source actions also accept supported collection and Pointer arguments, preserving value ownership.

Type, Atoms and Label are frontend roles using existing AML metadata. Nested constructors bind results once, in operand order, before the consuming word; composition slots retain their selected definitions. Native and ordinary Functions share body lowering and bind their own invocation words. Dependencies retain canonical source ownership.

Unknown kinds, incompatible types, missing bindings, invalid native names and malformed compositions reject. Text receives protected native quoting around AML/logeme delimiters; explicit native fragments retain target-dependent meaning.

^ integrates a child, * combines siblings and parentheses group compositions; assembly order does not promise universal runtime evaluation order. Func/Prop/Op records, imports and children retain their source-file owner. Classes cannot inject defaults into Objects.

Glyph-local Lifetimes/GenericTypes accept native String-list interiors only on FW/HY/MY declarations and Y/named-KY applications, with their explicit absence/blank rules. They are not L generics, Func/Prop/Op fields, inferred ownership or inherited settings. Rust rejects Deferred metadata, even false; scheduling implies neither scope-exit cleanup nor hidden continuations.

builtins/eng/core.l (lines 7–7)
"Objective" describes any Function as `<DEF>[["A", "<@Function@>"]]<DEF>`.

Fragment. Source: builtins/eng/core.l (lines 7–7).

Example evidence

Implicit Objective descriptor uses a grouped native word; the nested array is not an L collection literal. existing-witness-not-run. Evidence guide.

Objective's nested array preserves one word containing A and Function. It is native-composition grouping, not an L collection literal. Grouping tests check independent instances, not arbitrary runtime ordering.

Sources: core, parser/encoder, argument kinds, construction, actions, lexical forms, Rust inputs. Witnesses: composition, framing, slot names, actions, descriptor identity, local definitions.


Canonical source: docs/spec/definitions.md.