TYCHO Search

Search documentation

    ↑ ↓ to move · Enter to open · Esc to close

    Quickstart

    Ten minutes from a clone to a running Tycho program. The tutorial is the guided first hour; this page is the shortest path to output.

    1. Build

    Tycho needs make and a C11 compiler — gcc, or clang 15 or newer.

    $ git clone https://github.com/StefanVonRanda/tycho
    $ cd tycho
    $ make
    

    That builds ./tychoc. Prebuilt binaries are on the releases page.

    2. Write a program

    Save this as sum.ty:

    fn total(xs: [int]) -> int:
        s := 0
        for x in xs:
            s += x
        return s
    
    fn main():
        xs := [3, 1, 4, 1, 5]
        println("sum = " + str(total(xs)))
    
    sum = 14
    

    3. Run it

    $ ./tychoc sum.ty
    $ ./sum
    sum = 14
    

    tychoc transpiles to C and invokes your C compiler. There is no free in the program: xs and s live in the scope that owns them and are released when main returns. That is the whole memory model; from C to arenas explains it from malloc.

    Next