Skip to content

atemmel/ghoul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ghoul

👻

Getting started

Dependencies

  • posix
  • cmake >= 3.5
  • LLVM
  • g++
  • A version of clang or g++ with support for C++17 (or greater)

Build

git clone https://github.com/atemmel/ghoul.git
cd ghoul
mkdir build && cd build

# Development version
cmake .. -DCMAKE_BUILD_TYPE=Debug
make

Examples

Hello world

// hello.gh

import "io"			// printf

fn main() {			// void is implicit return type unless otherwise specified
	printf("Hello, World!\n")	// newlines replace semicolons
}

Factorial

// 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)
}

About

👻 Programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages