Alan grammar syntax
How to read grammars
- Literals between square brackets indicate required keywords, where a comma indicates if keywords go before or after a property. For example:
'name' [ '#' ] textimplies a hashtag before a name-text:
'name' [ '*' , '*' ] textimplies a star before and a star after a name-text:
* "Alice" *
'name' [ , '?' ] textimplies a question mark after a name-text:
textproperties require a double quoted string:
referenceproperties require a single quoted string:
'reference to Bob'
numberproperties require a numerical value:
stategroupproperties indicate a choice between different states, such as allowing or disallowing
collectionproperties require key-value pairs, where keys are single-quoted strings. For example, a
propertiesis written like this, depending on the required keywords and properties for the value:
'First Name': text = "Alice" 'Last Name': text = "Ecila"
componentproperties reference a rule in the grammar, to be instantiated at that point:
component 'abc'references rule
groupproperties just group properties that belong together
In the grammars,
indent is an instruction for the deparser/pretty-printer; you can ignore it.
Furthermore, properties that are marked
implicit exist for type checking purposes only.
Typical quirks of the Alan compiler
- Keywords should be separated by whitespace, so
()doesn’t work but
- Quotes are recognized as something special, so you can write
- Only tabs are accepted for indentation.