CLI & REPL Usage
Learn how to interact with the Nouva CLI and utilize the interactive Read-Eval-Print Loop (REPL).
1. Running Source Files
You can execute any Nouva source file (with the .nv extension) directly using either of the following commands:
# Direct path execution
./nouva script.nv
# Or using the run subcommand
./nouva run script.nv
Exit Codes & Errors
If the interpreter encounters a syntax error during parsing or a runtime type mismatch, it prints a formatted diagnostic message and exits with status code 1.
2. Interactive REPL
When run without arguments, Nouva starts an interactive REPL session allowing line-by-line experimentation:
$ ./nouva
NouvaLang REPL v0.1.0 (Interactive Shell)
Type 'exit' or press Ctrl+C to quit.
nouva> let x: int = 10;
10
nouva> let y: int = 25;
25
nouva> x * y;
250
nouva> fun greet(name: str) -> str { return "Hello, " + name; }
[function]
nouva> greet("World");
"Hello, World"
nouva> exit
Exiting the REPL
To exit the REPL at any time:
- Type
exitand press Enter. - Press
Ctrl + D(EOF) on Linux/macOS. - Press
Ctrl + Con any platform.