diff --git a/README.md b/README.md index 2419fd6..78381d2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # Akhamoth -statically typed functional language +An attempt at making something very much like Elixir, but with syntax I prefer +and static typing as a mandatory part of the language from the beginning. diff --git a/pages/syntax_reference.md b/pages/syntax_reference.md new file mode 100644 index 0000000..b92be29 --- /dev/null +++ b/pages/syntax_reference.md @@ -0,0 +1,66 @@ +# 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](https://www.unicode.org/reports/tr31/) 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 +`..` | requires parens +`=>` | right +`->` | right +`=` | right + +### Function Calls + +## AST + +The design of Akhamoth's AST is essentially the same as [Elixir's][1]. + +[1]: https://hexdocs.pm/elixir/main/syntax-reference.html#the-elixir-ast diff --git a/rebar.config b/rebar.config index 3604eed..53cc3a1 100644 --- a/rebar.config +++ b/rebar.config @@ -1,3 +1,12 @@ {erl_opts, [debug_info]}. {project_plugins, [rebar3_ex_doc]}. {deps, []}. +{ex_doc, [ + {extras, [ + {"README.md", #{title => <<"Overview">>}}, + "pages/syntax_reference.md" + ]}, + {main, "README.md"}, + {source_url, "https://git.wires.systems/wires/akhamoth"}, + {api_reference, false} +]}.