MaddLang Silver Standard
This document specifies the silver profile, which is interpreted in memory and intentionally excludes file access.
1. File Roles
.mls: silver source.
.mlb: bytecode may be executed by a VM, but silver implementations should treat it as optional infrastructure, not the primary source form.
2. Required Runtime Behavior
- Silver is interpreted in-memory.
- Silver reuses the same parser and type rules as gold where possible.
- Silver must reject file access with a silver-specific error.
- Silver may use the same bytecode engine internally, but this is an implementation detail.
3. Source Rules
- Identifiers, function names, suite names, and variable names are case-sensitive.
- Lowercase source types are standard and keywords are matched exactly.
- Typed declarations use
type name = value.
- Typed arrays use
type[] name = [value, value].
- Runtime references use
$name syntax.
- Silver has no direct pointers; only runtime references are exposed.
- Compile-time directives are allowed before interpretation.
4. Compile-Time Directives
Silver supports the same preprocessor directives as gold.
| Directive | Meaning |
$(name: value) | Set a compile-time value. |
$(define: name = value) | Define an expanded alias. |
$(if expr) | Start a conditional block. |
$(else) | Switch to the alternate branch. |
$(endif) | Close the conditional block. |
5. Silver Condition Rules
- Supported compile-time operators:
==, !=, contains, startswith, endswith.
- Truthiness fallback applies when no operator is provided.
- Inactive compile-time branches are removed before runtime interpretation.
6. Silver Runtime Restrictions
- No file handles.
- No file open/read/write/close builtins.
- No OS path or descriptor exposure.
- No raw pointer arithmetic in source.
- Runtime references remain safe handles to storage and respect identifier case.
- Silver does not allow pointer creation from
umax or any other address-like value.
7. Common Runtime Model
- Variables are typed at declaration.
- Arrays and index access are allowed when type rules permit.
- Conditionals and loops execute in-memory.
- Printing and string processing are allowed.
- Typed assignment errors should be reported as source errors before execution when possible.
- Arithmetic is supported with the same operator set as gold, but without file-oriented behavior.
8. Expression Precedence
Silver uses the same precedence model as gold for arithmetic expressions.
- Parentheses and indexing bind first.
- Unary negation binds before multiplication, division, and modulo.
- Multiplication, division, and modulo bind before addition and subtraction.
- Condition operators are separate from arithmetic parsing.
9. Function Parameters
- Functions may declare parameters in the block header.
- Plain parameters are passed by value into a local scope.
ref<type> parameters receive runtime references and can mutate the caller-visible storage.
- Local variables shadow outer variables inside the function scope.
- Silver does not expose pointer creation, even when reference parameters are used.
10. Example
$(std: silver)
$(if std == silver)
string message = "silver runtime"
print(message)
$(endif)
Silver is a portable, interpreted profile. Its implementation should favor correctness and stable runtime behavior over source-to-bytecode persistence.