No description
https://nara-lang.org
- Zig 99.7%
- Nix 0.2%
- Just 0.1%
|
|
||
|---|---|---|
| design | ||
| e2e | ||
| examples | ||
| src | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| CHANGELOG.md | ||
| flake.lock | ||
| flake.nix | ||
| Jenkinsfile | ||
| justfile | ||
| LICENSE | ||
| README.md | ||
The Nara programming language
Nara is a statically typed, compiled programming language. Compiles to its own bytecode format, and runs on its own VM.
There is documentation and a WIP spec at https://nara-lang.org.
Install
This program depends on the zig stdlib and naravm, the virtual machine target.
To run from source:
- Install the Zig programming language.
- Run
zig build runto run the debug build - Run
zig build -Doptimize=ReleaseFastto build the final binary - The binary will be located at
zig-out/bin/narac - Profit
Usage
Run nara --help to see usage.
Write source code
As of v0.0.5 the compiler is able to do:
- Basic u64 arithmetic
- Print strings
- Declare & use variables
var name = "John"
print("Hello, " + name + "!")
Compile to file
Run zig build run -- c /path/to/thp/source/code > out, where out is
the file to write the bytecode to. The compiler always writes to stdout.
Run bytecode
See the naravm package.
Compile & run in one command
Run zig build run -- run /path/to/nara/source/code. It will compile & run the code in one command.
Contributing
.path = "../naravm/"
Naming conventions
- When importing modules, use
m_<module-name>:const m_parser = @import("./parser.zig"); - Variables that hold a token have a
tok_prefix:const tok_number = ... - Variables that hold a type have a
t_prefix:const t_number = ... - Inside structs, the reference to self is always named
self, and a helper const is created:const Self = @This();