"""
S-expression language core.

Parse, evaluate, and serialize s-expressions.  This package provides the
foundation for the composable fragment architecture described in
``docs/sx-architecture-plan.md``.

Quick start::

    from shared.sx import parse, evaluate, serialize, Symbol, Keyword

    expr = parse('(let ((x 10)) (+ x 1))')
    result = evaluate(expr)          # → 11

    expr2 = parse('(map (fn (n) (* n n)) (list 1 2 3))')
    result2 = evaluate(expr2)        # → [1, 4, 9]
"""

from .types import (
    NIL,
    Component,
    HandlerDef,
    Keyword,
    Lambda,
    Macro,
    Symbol,
)
from .parser import (
    ParseError,
    parse,
    parse_all,
    serialize,
)
from .evaluator import (
    EvalError,
    evaluate,
    make_env,
)
from .primitives import (
    all_primitives,
    get_primitive,
    register_primitive,
)
from .env import Env

__all__ = [
    # Types
    "Symbol",
    "Keyword",
    "Lambda",
    "Macro",
    "Component",
    "HandlerDef",
    "NIL",
    # Parser
    "parse",
    "parse_all",
    "serialize",
    "ParseError",
    # Evaluator
    "evaluate",
    "make_env",
    "EvalError",
    # Primitives
    "register_primitive",
    "get_primitive",
    "all_primitives",
    # Environment
    "Env",
]
