AZHenley / knox

A toy programming language written in Go that compiles to C.
MIT License
96 stars 7 forks source link
compiler programming-language

The Knox Programming Language

Knox is an experimental language meant to help me learn Go and explore compiler design (NOTE: I don't work on this anymore.). It acts as a systems language with high-level constructs for convenience. The compiler is written in Go and generates C. It is very early in development.

The principles behind the design of Knox are:

func main() void {
    fizzbuzz(300);
}

func fizzbuzz(n : int) void {
    for i : int in stl.range(1,10,1) {
        if i%15 == 0 {
            stl.print("FizzBuzz");
        } else if i%3 == 0 {
            stl.print("Fizz");
        } else if i%5 == 0 {
            stl.print("Buzz");
        } else {
            stl.print(i);
        }
    }
}

Comparison to Go: