Skip to main content
This guide walks you through installing @lionlang/core, running your first Lion expression, and extending the environment with custom JavaScript values. You will have a working Lion program in under five minutes.
Lion requires two peer dependencies: effect for typed asynchronous evaluation, and typescript with strict mode enabled. Both must be installed in your project before using @lionlang/core.
1

Install @lionlang/core

Add the package and its peer dependencies to your project.
npm
yarn
pnpm
bun
2

Import run and stdlib

run is the top-level entry point for evaluating Lion expressions. stdlib is the default environment containing all built-in modules.
The run function accepts any JSON-compatible value as an expression and a plain object as the environment. It returns an Effect that resolves to the evaluation result.
3

Evaluate your first expression

Pass a Lion expression and the standard library environment to run, then execute the Effect with Effect.runPromise.
The expression ["number/add", 1, 2] is a plain JSON array. The first element, "number/add", resolves to a function in stdlib. The remaining elements are the arguments. The result is 3.
4

Add a custom environment

Spread stdlib into your own object to add custom bindings. Any string in a Lion expression resolves against the environment — including your own values, objects, and functions.
Because strings resolve at evaluation time, you can store Lion programs as JSON and supply different environments at runtime — changing behavior without modifying the program.

Next steps

Expression model

Learn how arrays, strings, objects, and primitives evaluate in detail.

Special forms

Explore define, lambda, cond, match, begin, and quote.

Standard library

Browse all built-in modules and their available functions.

Custom environment

Learn patterns for injecting JavaScript APIs into the Lion environment.