titan

所属分类:编程语言基础
开发工具:Lua
文件大小:0KB
下载次数:0
上传日期:2019-01-29 14:27:35
上 传 者sh-1993
说明:  Titan编程语言
(The Titan programming language)

文件列表:
.codecov.yml (208, 2019-01-29)
.editorconfig (271, 2019-01-29)
.travis.yml (1380, 2019-01-29)
LICENSE (1085, 2019-01-29)
c-parser/ (0, 2019-01-29)
c-parser/c99.lua (25119, 2019-01-29)
c-parser/cdefines.lua (4121, 2019-01-29)
c-parser/cdriver.lua (853, 2019-01-29)
c-parser/cpp.lua (24145, 2019-01-29)
c-parser/ctypes.lua (14610, 2019-01-29)
doc/ (0, 2019-01-29)
doc/manual.md (18403, 2019-01-29)
examples/ (0, 2019-01-29)
examples/artisanal.titan (3299, 2019-01-29)
examples/hello.bmp (1228938, 2019-01-29)
examples/sdl_demo.titan (1784, 2019-01-29)
examples/sdl_quit.titan (296, 2019-01-29)
examples/test_fill_table.lua (162, 2019-01-29)
examples/test_quicksort.lua (544, 2019-01-29)
examples/test_selection_sort.lua (543, 2019-01-29)
examples/test_sieve.lua (127, 2019-01-29)
examples/test_split_flatten.lua (222, 2019-01-29)
examples/test_sum_1_N.lua (140, 2019-01-29)
examples/utils.titan (486, 2019-01-29)
spec/ (0, 2019-01-29)
spec/checker_spec.lua (82439, 2019-01-29)
spec/coder_spec.lua (82821, 2019-01-29)
spec/lexer_spec.lua (10802, 2019-01-29)
spec/location_spec.lua (1195, 2019-01-29)
spec/parser_spec.lua (42021, 2019-01-29)
spec/symtab_spec.lua (716, 2019-01-29)
spec/types_spec.lua (2582, 2019-01-29)
spec/util_spec.lua (544, 2019-01-29)
testfiles/ (0, 2019-01-29)
testfiles/selection_sort.titan (507, 2019-01-29)
testfiles/sieve.titan (486, 2019-01-29)
titan-compiler/ (0, 2019-01-29)
titan-compiler/ast.lua (2895, 2019-01-29)
... ...

# Titan [![Build Status](https://travis-ci.org/titan-lang/titan.svg?branch=master)](https://travis-ci.org/titan-lang/titan) [![Coverage Status](https://codecov.io/gh/titan-lang/titan/coverage.svg?branch=master)](https://codecov.io/gh/titan-lang/titan/branch/master) Titan is a new programming language, designed to be a statically-typed, ahead-of-time compiled sister language to [Lua](http://www.lua.org). 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](http://www.lua.org/ftp/lua-5.3.5.tar.gz) 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](http://luarocks.org) 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](https://github.com/sqmedeiros/lpeglabel) >= 1.5.0 2. [inspect](https://github.com/kikito/inspect.lua) >= 3.1.0 3. [argparse](https://github.com/mpeterv/argparse) >= 0.5.0 4. [luafilesystem](https://github.com/keplerproject/luafilesystem) >= 1.7.0 # Usage $ titanc [--print-ast] [--lua ] [--tree ] [] 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: * if one of your Titan modules has a `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. * Otherwise, it will compile each module into a shared library (in the same path as the module source) that you can `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. # 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 to the Lua sources (default 'lua-5.3.5/src') --tree 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 * control structures * integers * floats * booleans * strings * arrays * top-level functions * early-bound modules * multiple assignment/multiple returns * FFI with C (C pointers, call C functions) * records (structs) with methods * maps ## In progress * first-class functions (still only in the top-level) ## Next * FFI with C, continued (C arrays, C structs) * standard library that is a subset of Lua's standard library, built using the C FFI * tagged variants (unions of structs with some syntax for switch/case on the tag) * polymorphic functions * for-in * self-hosted compiler * nested and anonymous first-class functions with proper lexical scoping (closures) * ":" syntax sugar for records of functions * classes with single inheritance, either Go/Java/C#/Swift-like interfaces/protocols or Haskell/Rust-like typeclasses/traits * ":" method calls (not syntax sugar) * operator overloading * ...Titan 1.0!

近期下载者

相关文件


收藏者