Files
rifle/SPEC.md
2026-03-17 01:14:49 -04:00

947 B

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 ':'.