Skip to content

Toy programming language implemented in Go. Made to learn about lexers, parsers, etc.

License

Notifications You must be signed in to change notification settings

winstonjay/Dito

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

93 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dito Programming Language

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.

Examples

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]
}

Having a go...

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

About

Toy programming language implemented in Go. Made to learn about lexers, parsers, etc.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages