lily

This repository has moved: https://gitlab.com/FascinatedBox/lily

Github星跟蹤圖

Linux: Linux Build

Windows: Windows Build

Test Coverage: codecov

Lily

Lily is a programming language focused on expressiveness and type safety.

Sample

scoped enum Color { Black, Blue, Cyan, Green, Magenta, Red, White, Yellow }

class Terminal(var @foreground: Color, width_str: String)
{
    public var @width = width_str.parse_i().unwrap_or(80)

    public define set_fg(new_color: Color) {
        @foreground = new_color
    }
}

var terms = [Terminal(Color.White, "A"), Terminal(Color.Red, "40")]

terms.each(, e, e.width += 20 ), > print

Features

Templating

By default, Lily runs in standalone mode where all content is code to
execute. But Lily can also be run in template mode. In template mode,
code is between <?lily ... ?> tags. When a file is imported, it's always
loaded in standalone mode, so that it doesn't accidentally send headers.
Files that are imported are also namespaced (no 'global namespace').

Embeddable

Lily may be a statically-typed language, but the reference implementation is an
interpreter. The interpreter as well as its API have been carefully designed
with sandboxing in mind. As a result, it's possible to have multiple
interpreters exist alongside each other.

Shorter edit cycle

Another benefit from having the reference implementation as an interpreter is a
shorter turn around time. The interpreter's parser is comparable in speed to
that of languages using an interpreter as their reference.

Building

You need a C compiler and CMake (3.0.0 +). There are no external dependencies.

To build Lily, execute the following in a terminal:

cmake .

make

Note: Windows users may need to add -G"Unix Makefiles" to the end of the cmake
invocation.

The above will build the lily executable, as well as a liblily that you can
use with your program. It also builds pre-commit-tests.

Running tests

The centerpiece of Lily's testing is test_main.lily in the test directory.
That file imports and invokes a large number of tests that cover a lot of Lily.

The make command also builds covlib and pre-commit-tests. No additional
commands are necessary. covlib is a library that tests some parts of Lily that
native code can't test. pre-commit-tests is a special runner that executes
test_main.lily.

To run Lily's tests, execute pre-commit-tests from the directory it's in after
building Lily.

Community

Lily is a very young language and the community is still growing.

  • Discord: Lily to chat with others in real-time.

  • IRC: freenode #lily is
    another way to chat with others.

  • Reddit: /r/lily for discussion around the
    language and providing support to new users.

Resources

License

MIT

主要指標

概覽
名稱與所有者FascinatedBox/lily
主編程語言C
編程語言C (語言數: 6)
平台
許可證MIT License
所有者活动
創建於2014-04-05 03:24:41
推送於2025-06-09 01:49:13
最后一次提交
發布數32
最新版本名稱v2.0 (發布於 2021-07-10 00:00:00)
第一版名稱v0.5 (發布於 )
用户参与
星數1.1k
關注者數32
派生數38
提交數3.3k
已啟用問題?
問題數343
打開的問題數0
拉請求數31
打開的拉請求數0
關閉的拉請求數4
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?