1.8 KiB
Syntax Reference
In Akhamoth, everything is an expression.
Literals
Identifiers
Identifiers are composed of ASCII letters, digits, and underscores and may not
begin with a digit. The preferred naming convention is UpperCamelCase
for type
names, snake_case
for variables, functions, and modules, and
SCREAMING_SNAKE_CASE
for global constants. Identifiers, beginning with an
underscore are typically intentionally unused variables and will silence
warnings about this from the compiler.
Unicode Identifiers {: .info}
For version 1.0 of Akhamoth, the goal is only to support ASCII identifiers in order to make parsing easier. In the future however, it would be good to look at implementing UAX #31 unicode identifiers.
Atoms
Atoms have the exact same syntax as identifiers, but are prefixed with :
, e.g.
:akhamoth
.
Strings
A String literal consists of "
followed by any number of other characters and
then another "
. Currently there is no support for character escapes of any
kind. This will be rectified before version 1.0.
Integers
Integer literals must begin with a digit, followed by any number of digits and
underscores. Underscores are intended to be used for grouping digits in long
numbers, e.g. 1_000_000_000
.
Expressions
Operators
The following is a list of all operators in Akhamoth, ordered from highest precedence to lowest, along with their associativity:
Operator | Associativity |
---|---|
. |
left |
- |
unary |
* / |
left |
+ - |
left |
|> |
left |
== |
requires parens |
=> |
right |
-> |
right |
= |
right |
Function Calls
AST
The design of Akhamoth's AST is essentially the same as Elixir's.