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.
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.
$ 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:
main
function, with signature
function({string}):integer
, then titanc
will bundle all modules
given in the command-line, along with all their dependencies where
source code was available, as a stand-alone executable program.import
from
Titan as well as require
from Lua, and call any exported
functions/access exported variables. For each generated module, any
of its transitive imports is statically linked if source code was
found; dependencies that were only available as a shared library
will be dynamically loaded.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.
--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.
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: