Dito is a work-in-progress toy interpeted language made to learn about writing parsers, interpeters etc. Things change around a bit so some docs arn't up to date. The syntax is pretty generic at the moment but probally will try out some more idiosyncratic concepts in the future.
This is the most up to date repo but its not that stable.
For full list of examples see examples
directory or the stdlib.
Heres example of dynamic programming used to find the total number of ways a target number can
be made given a set of coins. This can be found in full in the exampls dir described.
def main() {
let coins = [1, 2, 5, 10, 20, 50, 100, 200]
let target = 200
print(coinSums(coins, target))
}
def coinSums(coins, target) {
let sack = array(target+1)
sack[0] = 1
for coin in coins {
for i in range(coin, target+1) {
sack[i] += sack[i-coin]
}
}
return sack[target]
}
The most simple way to build with go build
then use the executable or just go run main.go
. You can try out the language either in a interactive shell with:
./dito
or to run a file:
./dito funcs.dito