MCPcopy Index your code
hub / github.com/FascinatedBox/lily

github.com/FascinatedBox/lily @v2.4

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.4 ↗ · + Follow
1,580 symbols 5,312 edges 95 files 177 documented · 11% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README
<img alt="Lily Logo" src="https://lily-lang.org/assets/lily-logo.svg">

Discord Pipeline Status Windows Build Coverage Report

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(public 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 (C11+) and CMake (3.10+). There are no external dependencies.

To build Lily, execute the following in a terminal:

cmake .
cmake --build .

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.

Resources

Packaging

The lily-garden repository contains a package manager (Garden) that simplifies the install of Lily packages.

License

MIT

Core symbols most depended-on inside this repo

lily_raise_syn
called by 189
src/lily_raiser.c
lily_malloc
called by 127
src/lily_alloc.c
lily_next_token
called by 124
src/lily_lexer.c
lily_free
called by 124
src/lily_alloc.c
lily_return_top
called by 73
src/lily_api.c
lily_arg_value
called by 65
src/lily_api.c
lily_mb_add
called by 62
src/lily_msgbuf.c
lily_raise_tree
called by 61
src/lily_raiser.c

Shape

Function 1,451
Class 129

Languages

C92%
C++8%
Ruby1%
Python1%

Modules by API surface

src/lily_parser.c265 symbols
src/lily_emitter.c185 symbols
src/lily_pkg_prelude.c143 symbols
src/lily_pkg_introspect.c138 symbols
src/lily_api.c106 symbols
src/lily_vm.c72 symbols
src/lily_symtab.c47 symbols
test/t/src/lily_covlib.c42 symbols
src/lily_expr.c42 symbols
src/lily_pkg_math.c38 symbols
test/t/src/lily_backbone.c37 symbols
src/lily_lexer.c37 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add lily \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact