tcel

command module
v0.0.0-...-0cd0f30 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2014 License: GPL-2.0 Imports: 15 Imported by: 0

README

TCEL - A Language

By Tim Henderson (tadh@case.edu)

This is a simple language with a static type checker. It is an -interpreted- expression oriented functional language.

(interpreted is a strong word. It now has a semi-functional code generator)

It features:

  • First class functions
  • Closures
  • Integers, floats, strings, booleans
  • Conditional expressions

This language is evolving fast and may have undocumented features or bugs. It started out as an example I wrote for the compilers class I teach, EECS 337 Compiler Design, at Case Western Reserve University.

Running:
$ go get github.com/timtadh/tcel
$ tcel ./ex/fib.x
Example Computing the Fibonacci Sequence

file ./ex/fib.x

add = fn(x int) fn(int) int {
    fn(y int) int {
        x + y
    }
}

fib = fn(i int) int {
    if i <= 1 {
        1
    } else {
        add(self(i-1))(self(i-2))
    }
}

fib(0)
fib(1)
fib(2)
fib(3)
fib(4)
fib(5)
fib(6)
$ tcel ex/fib.x 
> lexing ex/fib.x
> parsing ex/fib.x
> type checking
> evaluating
unit
unit
1
1
2
3
5
8
13

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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