start writing up some docs

mostly to help me remember what the plan is
This commit is contained in:
wires 2025-03-11 23:02:07 -04:00
parent e2ba4d16f4
commit 1c5e487e61
Signed by: wires
SSH key fingerprint: SHA256:9GtP+M3O2IivPDlw1UY872UPUuJH2gI0yG6ExBxaaiM
3 changed files with 77 additions and 1 deletions

View file

@ -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.

66
pages/syntax_reference.md Normal file
View file

@ -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

View file

@ -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}
]}.