Code Monkey home page Code Monkey logo

tcel's Introduction

TCEL - A Language

By Tim Henderson ([email protected])

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

tcel's People

Contributors

timtadh avatar auyer avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.