Home

Awesome

Titan

Build Status Coverage Status

Titan is a new programming language, designed to be a statically-typed, ahead-of-time compiled sister language to Lua. It is an application programming language with a focus on performance.

Install

First you need to download, extract and build the sources to Lua 5.3.5 inside the folder where you cloned this repository. The Lua tarball will extract to a lua-5.3.5 folder. Enter it and build Lua with make linux MYCFLAGS=-fPIC.

You can install the Titan compiler itself using LuaRocks this will also install all dependencies automatically.

    $ [install luarocks]
    $ luarocks make titan-scm-1.rockspec

To install without sudo permissions.

    $ [cd into titan folder]
    $ luarocks build --local

You can also run the Titan compiler directly from the folder where you cloned this repository if you install all the dependencies for the compiler.

Requirements for running the compiler

  1. LPegLabel >= 1.5.0
  2. inspect >= 3.1.0
  3. argparse >= 0.5.0
  4. luafilesystem >= 1.7.0

Usage

    $ titanc [--print-ast] [--lua <path>] [--tree <path>] <module> [<module>]

The compiler takes a list of module names that you want to compile. Modules are looked up in the source tree (defaults to the current working directory, but you can override this with the --tree option), as well as in the Titan binary path, a semicolon-separated list of paths (defaults to .;/usr/local/lib/titan/0.5, you can override with a TITAN_PATH_0_5 or TITAN_PATH environment variable).

If everything is all right with your modules, you will get the result of your compilation as a native binary:

Running the test suite

The test suite es written using Busted, which can be installed using LuaRocks:

    $ luarocks install busted

Then, you need to bulid the local copy of Lua, and run busted from the root directory of this repository:

    $ cd lua
    $ make linux
    $ cd ..
    $ busted

You may need to adapt the invocation of make above to your platform.

Compiler options

    --print-ast                     Print the AST.
    --lua <path>                    Path to the Lua sources (default 'lua-5.3.5/src')
    --tree <path>                   Path to the source tree for your Titan modules (default '.')
    -h, --help                      Show this help message and exit.
    

Tentative roadmap

This is a very preliminary roadmap towards Titan 1.0, where everything is subject to change, with things more likely to change the further they are in the roadmap:

Supported

In progress

Next