01 / PROGRAM
Statements and separators
A source is a sequence of statements such as declarations and expressions. Separate statements with a newline or semicolon; a separator may be omitted before a closing brace or at end of source. Newlines are allowed inside parentheses, but there is no general continuation of expressions outside them.
let title = "Hello"
fn label(value) {
strong { value }
}
02 / NODE
Expressions and document nodes
Function and constructor calls are expressions that can return any value. A document node is a tag followed by optional class shorthand, parenthesized attributes, and a body block containing children. Attribute values may be full expressions; later values replace earlier entries with the same key.
article.card#intro(title="Welcome") {
h1 { "Hello" }
p { "A Matra document." }
}
03 / CONTROL
Control expressions and child spread
Use if/else_if/else, for, while, and do-until. An if returns the selected block's value; for returns a list of each completed iteration's block value. Each expression in a node body adds one child; ...expression spreads an array one level. null remains part of the value model.
let rows = for (item in ["one", "two"]) {
li { item }
}
ul { ...rows }
04 / MARKUP
XML-style markup
The document profile accepts XML-style markup as an expression. Quoted attribute strings, body text, and child elements are retained; standard character references are decoded. Matra expressions are not interpolated into markup text. This is not full XML/HTML compatibility; malformed attributes and closing tags are rejected.
<img src="image.png" />
<p>Hello <strong>Matra</strong>!</p>
05 / EXPRESSION
Expressions, scope, and limits
Expressions include literals, references, arrays/objects, member access, calls, unary/binary operators, and control expressions. Blocks have lexical scope; functions capture their declaration scope. The v0.3 document profile excludes module imports, type inference, multiline strings, general trailing-block calls, and line continuation outside parentheses.