Language Guide
Raml at a glance — syntax, structure, and feature overview. This page gives you the big picture. Follow the links to individual pages for full details.
Syntax
Blocks start after : and are defined by 4-space indentation. Semicolons are optional. Labels are :name: and can be targets for jump.
:start: // program entry point
x = 5 // variable declaration
print x // output
See Grammar Overview for the full statement list.
Types and Values
| Type | Description | Examples |
|---|---|---|
bs | Dynamic bitstream (sole scalar) | "hello", data = keyboard |
name# | Typed object pointer | node# np = @n |
Declaration forms:
x y z = 10 // inferred types: multiple vars
count = 5 // inferred: defaults to bs
value = 42 // inferred: defaults to bs
Literals: decimal (42), hex (0xFF), binary (0b1010), single/double/triple-quoted strings.
See Types and Values for the complete reference.
Operators
Full precedence table and operator reference →
result = (a + b) * c // arithmetic
masked = value & 0xFF // bitwise
in_range = ::x > 0:: && ::x < 10:: // comparison + logical
Key difference from C: Comparisons in method/function arguments require ::expr:: grouping.
Control Flow
// Conditional
if condition:
stmt
orif condition2:
stmt
else:
stmt
// Loop
while condition:
stmt
// Branching
switch expr:
case 1:
stmt
default:
stmt
// Error handling
try:
stmt
catch:
stmt
// Local jump
:label:
jump :label:
Objects and Methods
Objects define fields and methods. Methods use ->receiver:method syntax:
counter:
value
functions:
init:
in: start
value = start
inc:
in: step
value += step
:start:
c = make counter 0
->c:inc 5
Features:
- Nested objects: indented field blocks
- External methods:
typeName:methodName:syntax - Multi-field assignment:
:f1 f2 f3: = value - Dynamic field access:
object:expr: - Range field check:
c:1..9: == 0: - Return values: last expression in a function/method body is automatically returned
See Memory for pointer operations on objects.
Memory
n = make node 42 // stack allocation
n = make node 42 auto // heap allocation
@var // address-of
#ptr // dereference
free var // deallocation
Manual memory management — no garbage collector. See Memory for the full guide.
Built-ins and IO
input = keyboard // read stdin
print "x" x "y" y // output
save "f.bin" data // file write
data = load "f.bin" // file read
len s // bitstream length
abs -42 // absolute value
min 3 7 // minimum
max 3 7 // maximum
pow 2 8 // power
See Built-ins and IO for details, including automatic bs_t → uint32_t conversion.
Comments
// single-line
/* block */
… ellipsis comment (ignored)
Keyword Localization
Raml supports non-English keywords via keywords.raml.lang files. See Keywords and Localization.
Quick Reference vs Deep Dives
| Topic | Quick Intro | Full Details |
|---|---|---|
| Types | This page | Types and Values |
| Operators | Operators — full reference | Design Notes — rationale |
| Memory | This page | Memory Management |
| Built-ins | This page | Built-ins and IO |
| Grammar | Grammar Overview | Grammar Reference |