👻
posix
cmake
>= 3.5LLVM
g++
- A version of
clang
org++
with support forC++17
(or greater)
git clone https://github.com/atemmel/ghoul.git
cd ghoul
mkdir build && cd build
# Development version
cmake .. -DCMAKE_BUILD_TYPE=Debug
make
// hello.gh
import "io" // printf
fn main() { // void is implicit return type unless otherwise specified
printf("Hello, World!\n") // newlines replace semicolons
}
// factorial.gh
import "io"
fn main() {
int n = 5
printf("Factorial of %d is %d\n", n, factorial(n) )
}
fn factorial(int n) int { // Order of function declarations is resolved at compile-time
if n <= 1 { // Branches do not need parantheses to contain their expressions
return 1
}
return n * factorial(n - 1)
}