dito

command module
v0.0.0-...-55fb52d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2019 License: MIT Imports: 10 Imported by: 0

README

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

Documentation

Overview

Dito is a Toy interpreted programming language for fun. : )

Directories

Path Synopsis
src
ast
parser
Package parser implements Dito's Parser.
Package parser implements Dito's Parser.
scanner
Package scanner implements Dito's Lexical Scanner.
Package scanner implements Dito's Lexical Scanner.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL