Features Examples Docs GitHub
A New Kind of Language

The JSON-Based Lisp
for Modern Systems

All code is valid JSON. All JSON is valid code. Serializable, homoiconic, and trivially parseable by any system.

example.lion.json
["number/add", ["number/multiply", 3, 4], ["number/subtract", 10, 5]]

// Evaluates to: 17
100% JSON Compatible
0 Custom Parsers Needed
Type Safe with Effect
MIT Licensed
Core Concepts

Why Lion?

A language designed for the modern web, where data and code seamlessly interoperate.

Homoiconic

Code is data, data is code. Manipulate programs as easily as you manipulate JSON objects.

Serializable

Store programs in databases, send them over APIs, or persist them to files. It's just JSON.

Extensible

Add custom functions to the environment. Your functions become first-class citizens.

Type-Safe

Built with Effect and Schema for runtime type validation and powerful error handling.

Universal

Any system that reads JSON can work with Lion programs. No special tooling required.

Composable

Expressions nest naturally. Build complex logic from simple, reusable building blocks.

See It In Action

Code Examples

Explore how Lion handles everything from basic arithmetic to complex logic.

Basic Arithmetic

Function calls use Lisp-style prefix notation within JSON arrays.

["number/add", 1, 2]
// => 3

["number/multiply", 5, 4]
// => 20

Conditionals

Use cond for multi-branch conditionals with pattern matching.

["cond",
  [["number/greaterThan", "score", 90], "great"],
  [["number/greaterThan", "score", 70], "pass"],
  ["else", "retry"]
]

Record Evaluation

Objects preserve keys and evaluate each value.

{
  "sum": ["number/add", 1, 2],
  "ok": true
}
// => { "sum": 3, "ok": true }

Lambda Functions

Create functions with lexical scope using lambda.

["lambda", ["x"], ["number/add", "x", 1]]

// Define and use:
["begin",
  ["define", "inc", ["lambda", ["x"], ["number/add", "x", 1]]],
  ["inc", 41]
]
// => 42

Custom Environment

Extend stdlib with your own values and functions.

const env = {
  ...stdlib,
  price: 100,
  taxRate: 0.08,
  clamp: (min, max, val) => Math.min(max, Math.max(min, val))
};

["number/add", "price", ["number/multiply", "price", "taxRate"]]
// => 108

Quote & Eval

Control evaluation with quote and eval special forms.

["quote", ["number/add", 1, 2]]
// => ["number/add", 1, 2]

["eval", ["quote", ["number/add", 1, 2]]]
// => 3
Get Started

Quick Start

Start using Lion in your TypeScript projects today.

1

Install the package

npm install @lionlang/core
2

Import and run

import { Effect } from "effect";
import { run } from "@lionlang/core/evaluation/evaluate";
import { stdlib } from "@lionlang/core/modules";

const result = await Effect.runPromise(
  run(["number/add", 1, 2], stdlib)
);
// => 3
3

Extend the environment

const env = {
  ...stdlib,
  price: 100,
  taxRate: 0.08,
};

await Effect.runPromise(
  run(["number/add", "price", ["number/multiply", "price", "taxRate"]], env)
);
// => 108

Ready to try Lion?

Join the community and start building with a language where code and data are one.