docs: Add initial language spec

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-03-17 01:14:49 -04:00
parent 99f52e02b2
commit 0d628c8df3

34
SPEC.md Normal file
View File

@@ -0,0 +1,34 @@
# The Rifle specification
## About Rifle
The rifle programming language is a language aiming to keep optimization down to
a minimum. It is to have a somewhat C-like syntax and seperate directive/keyword
namespace.
## Identifiers
Identifiers are names that exist within the program that represent a specific
symbol/object. If the name is prefixed with a dot '.' it is a reserved keyword
or directive.
## A simple main function
```
// Function is public
// | This is a function
// | / Identifier
// | | | Type designator
// | | | / Type
// | | | / /
// | | | | |
// | | | | |
.pub .f main() : u32 {
return 0; // <-- Return statement
}
```
A few things are going on here, first we declare the function
as public (i.e., visible externally from the current file), then
we use '.f' to denote that we are defining a function, followed by
an identifier, a set of parenthesis and a type after the ':'.