golfcart

⛳ A minimal programming language inspired by Ink, JavaScript, and Python.

MIT License

Stars
25

Bot releases are hidden (Show)

golfcart - Golfcart v0.1 Latest Release

Published by healeycodes over 3 years ago

This is the initial release of Golfcart! My toy programming language is feature complete.

The language syntax is fully implemented and complex programs can be run.

e.g. the Fibonacci sequence.

// Naive
t = time()
fib = n => if n == 0 {
    0
} else if n == 1 {
    1
} else {
    fib(n - 1) + fib(n - 2)
}
fib(20)
log("fib: " + str(time() - t))

// With memoization 
t = time()
cache = {"0": 0, "1": 1}
fib_memo = n => if cache[n] != nil {
    cache[n]
} else {
    cache[n] = fib_memo(n - 1) + fib_memo(n - 2)
}
fib_memo(20)
log("fib_memo: " + str(time() - t))

The test suite + example programs all run without error. But you shouldn't use this in production.

Package Rankings
Top 9.7% on Proxy.golang.org
Badges
Extracted from project README
Go