Explicit meaning
Programs name their ontology and vocabulary. The compiler checks admitted forms instead of evaluating arbitrary host code.
An ontology-based programming language
Mithril is its own ontology-based language. Its structured Form source is distinct from JSON-LD, and the two representations can be converted in either direction under a pinned context.
Language reference · living draft
(mithril/module
:name "host.conditional"
:exports ["choose" "lazy"]
:functions
[(mithril/function
:name "choose"
:params [(rdf/node :name "value" :datatype "js-value")
(rdf/node :name "fallback" :datatype "js-value")]
:returns "js-value"
:body (mithril/if
:condition (mithril/call :name "js_nullish"
:args [(mithril/local :name "value")])
:then (mithril/local :name "fallback")
:else (mithril/local :name "value")))])
Programs name their ontology and vocabulary. The compiler checks admitted forms instead of evaluating arbitrary host code.
Mithril Form and JSON-LD 1.1 are distinct, mutually convertible representations. Sources denoting the same graph share a canonical RDF Dataset identity.
Typed actions cross into Kotoba and Amu through checked interfaces, with host capabilities kept explicit.
01 · The language
Mithril is an ontology-based language for describing programs and their meaning. A source document identifies the vocabulary it uses; the compiler projects it into RDF, validates its declared shape, and emits a typed action artifact.
.mith · .mithrilBoth suffixes are accepted aliases.
Tagged S-expressions with keyword fields, nested forms, and vectors.
Distinct source formats, convertible in both directions under a pinned context.
Unknown tags, fields, or shapes are refused by their admitted profile.
02 · Source grammar
The excerpt below shows the canonical reader shape and the token rules that decide source spelling. The published grammar.ebnf is the token-layer table of record. Each form tag defines its own allowed fields, argument positions, types, and vocabulary; the reader accepts one top-level form and treats it as data without running Clojure, resolving namespaces, or invoking host functions.
mithril.form/v0; (mithril/form:v1) opts in to the versioned data profile.[-2^63, 2^63-1]. Decimal and hexadecimal tokens are admitted without js/Number conversion.#?/#?@ conditionals are opt-in data-profile forms. [:sum ...] is code-profile surface sugar; native Amu and public-library profiles refuse sums.form-source = trivia, tagged-form, trivia ;
versioned-source = trivia, [ version-marker, trivia ], tagged-form, trivia ;
tagged-form = "(", symbol, { trivia, argument }, trivia, ")" ;
argument = keyword, trivia, value | value ;
value = string | integer | boolean | nil | vector
| conditional | sum-type | tagged-form ;
symbol = ? 1 to 128 characters, none of them trivia, "(", ")", "[",
"]", "{", "}", '"', ";", or a refused dispatch character
(@, ^, `, ~, \\, #); a numeric-looking token is an integer
token, never a symbol; nil, true and false are literals ? ;
keyword = ":", ? 1 to 127 characters under the symbol rule ? ;
integer = [ "-" | "+" ], ( "0", ( "x" | "X" ), hex-digit, { hex-digit }
| "0"
| non-zero-digit, { digit } ) ;
version-marker = "(mithril/form:v1)" ;
conditional = "#?", "(", feature-test, value, { feature-test, value }, ")"
| "#?@", "(", feature-test, value, { feature-test, value }, ")" ;
feature-test = keyword | "[", keyword, { keyword }, "]" ;
sum-type = "[", ":sum", sum-name, sum-case, { sum-case }, "]" ;
This compact excerpt is checked against the published grammar. The full EBNF carries every production, profile restriction, and named refusal; it is not a promise that every tag accepts every syntactically valid value. Type and field rules remain defined by the selected Mithril vocabulary and compiler profile. Full EBNF.
03 · Execution model
The execution foundation is Kotoba Lang’s typed runtime and Amu compiler/backend. Amu’s self-hosting compiler path belongs to the Kotoba/Amu toolchain; Mithril’s own compiler front end remains implemented with CLJK/CLJS host primitives.
Boundary: Amu self-hosting does not mean the Mithril compiler itself is self-hosted. Mithril’s declared .mith language kernel describes and admits its orchestration; host readers, RDF adapters, and compiler primitives remain explicit implementation components.