Source code structure
Indentation
Velia uses indentation to delineate blocks.
#main
print-line(“Block 1”)
#do
print-line(“Block 2”)
print-line(“Block 1 again”)
Comments
Comments start with en-dashes (–) and reach until the end of the line.
Multi-line comments are delimited by en-dashes above and below. They can be nested with additional en-dashes at each delimiter:
– This is a one-line comment.
–
This is a multi-line comment.
It ends with another en-dash on a separate line.
––
This is a nested comment.
––
The outer comment ends here.
–
When a comment appears right before a declaration, it is interpreted as a documentation comment:
– Adds two numbers.
add-2 ← # (x, y) x + y
–
A record type that represents a person.
It has two fields, name and age.
–
person ← #record
name: string
age: unsigned-int
Reserved tokens
Keywords always begin with a #. Examples:
#module #main #record #match
This prevents keywords from clashing with regular identifiers.
In addition, Veila uses the following arrows, as well as their ASCII-substitutes, for declarations and assignment. These cannot be used as part of identifiers.
← ⥳ ⥆ <- <~ <+