Note
Noa is currently a heavily work-in-progress project. The current state of the project does not fully represent what the final result is meant to look like.
Noa is a dynamically typed, imperative, compiled programming language. The language features a familiar C/JS/Rust-like syntax with static variable resolution (so no "variable is not defined" errors!) and a lightweight featureset. Jump down to the samples section for some code samples!
Noa compiles to its own cross-platform bytecode format Ark which in turn can be run through the Noa runtime.
In addition to the language itself, Noa also features a VSCode extension with full(-ish) language support! The extension currently supports basic syntax highlighting, error messages, basic intellisense, go to definition, find all references, and renaming symbols!
This merely a passion project of mine and is not meant to be taken seriously! It's not meant to be a "production-ready" language, but I hope to one day be able to write some somewhat useful programs in it.
Noa is 100% guaranteed free from the output of generative AI!
Note
Noa can currently only be compiled from source.
Compile from source
To compile and install Noa from source, you need the .NET 9 SDK and runtime and Cargo to compile the compiler and runtime respectively. Once you have .NET and Cargo installed, follow these instructions:
- Clone the repo using
git clone https://github.com/thinker227/noa.git. cdinto the root of the project (the folder which contains this readme file).- Run
./build.sh <dir>, replacing<dir>with the path to the folder you want Noa to be installed to. This will compile the compiler and runtime put both executables into<dir>(along with some other artifacts). - Optionally, run the command the build script prints out at the end if you want to set up your
$PATHso thatnoawill be available from the command-line. You may have to restart your terminal afterwards for it to be available. - Once finished, you can run
noa runtimeto check everything is set up properly.
Compile from source
To compile and install the VSCode extension from source, you need Node.js and vsce. Also make sure you have code available from the command line.
cdintosrc/vscode-extensionand runnpm installfollowed bynpm run compile.- Run
vsce package --skip-license. - Run
code --install-extension <path>, replacing<path>with the file path to the.vsixfile whichvscegenerated.
The Noa CLI accepts various configuration options. You can specify these by creating a .noa folder with a config.json inside it. When running a command like noa build, the CLI will look for a .noa/config.json file in the folder the command is ran in or any parent parent folders. If you wish to have a global configuration, you can put this in your home folder, for example.
Here is an example configuration:
{
// Set the CLI to use a custom runtime.
"runtimePath": "~/.noa/custom_runtime"
}- AST
- Lexer
- Parser
- Scope/symbol resolution
- Flow analysis
- Optimization
- Bytecode
- Runtime
- CLI
- Language server
Warning
Some of these samples may currently not work.
print("Hello world!");let x = 0;
x = 1; // ERROR: x is immutable
let mut y = 2;
y = 3; // finelet x = { // Block expression
let a = 1;
let b = 2;
a + b // Implicit return from block
};func add(a, b) => a + b;
let num = add(1, 2);func greet(name) {
print("Hello, " + name + "!");
};
let name = readLine();
greet(name);func createCounter() {
let mut x = 0;
() => {
x += 1;
x
}
}
let counter = createCounter();
print(counter()); // 1
print(counter()); // 2
print(counter()); // 3