Night is a bytecode interpreted language.
You can download either the Windows or Linux binary file in the Releases section.
Then create a .night
file containing your Night code. Example programs can be found under the programs
directory.
To run a Night file, simply type,
night source.night
Try it out now with this simple Night code!
# recursive fib function
def fib(n int) int
{
if (n == 0 || n == 1)
return n;
return fib(n - 1) + fib(n - 2);
}
print("Enter a number: ");
n int = int(input());
for (i int = 0; i < n; i += 1)
print(str(fib(i)) + " ");
The programs
directory contain simple programs written in Night, including some Harvard's CS50 programs and some common Math programs. These programs are also used in the CI pipeline as integration tests.
Dependenies, cmake
g++
First, clone the repo and move into that directory. Generate MinGW or Unix Makefiles using cmake
, and then build (optionally specify a Release build with --Release
). You should then see a night
exectuable file in the current directory.
Windows Build:
git clone https://github.com/alex/apostolu/night.git
cd night
cmake -G "MinGW Makefiles" .
cmake --build .
# Optional
# cmake --build . --Release
night source.night
Linux Build:
cd night
cmake -G "Unix Makefiles" .
cmake --build .
./night source.night