# L4 Language Reference

The L4 language reference provides precise technical documentation for all language features. Use this section to look up specific keywords, types, operators, and syntax rules.

## Contents

### [📚 GLOSSARY](/l4/reference/GLOSSARY.md)

Master index linking to all language features - start here to find what you need.

### [Cross-Language Cheat Sheet](/l4/reference/cheat-sheet.md)

Quick translation guide mapping constructs from Python, JavaScript, Java, Haskell, and SQL to their L4 equivalents.

### Language Components

#### [Functions](/l4/reference/functions.md)

Keywords for defining functions and computations:

- **Parameters:** GIVEN, GIVETH
- **Definitions:** DECIDE, MEANS, YIELD
- **Local bindings:** LET, WHERE
- **Aliases:** AKA

#### [Types](/l4/reference/types.md)

L4's type system for representing data:

- **Primitives:** BOOLEAN, NUMBER, STRING, DATE
- **Type Constructors:** DECLARE, IS, HAS, ONE OF
- **Polymorphic Types:** LIST, MAYBE, EITHER

#### [Operators](/l4/reference/operators.md)

Operations for computing and comparing values:

- **Arithmetic:** PLUS, MINUS, TIMES, DIVIDED BY, MODULO
- **Comparison:** EQUALS, GREATER THAN, LESS THAN, AT MOST, AT LEAST
- **Logical:** AND, OR, NOT, IMPLIES
- **String:** CONCAT, APPEND
- **Temporal:** AT, WITHIN

#### [Syntax](/l4/reference/syntax.md)

Structural rules and special syntax patterns:

- **Layout Rules:** Indentation-based grouping
- **Comments:** `--` and `{- -}`
- **Identifiers:** Backtick-quoted names
- **Annotations:** `@desc`, `@nlg`, `@ref`, `@export`
- **Directives:** `#EVAL`, `#TRACE`, `#CHECK`, `#ASSERT`
- **Special Syntax:** Ditto (`^`), Asyndetic (`...`, `..`)

### [Libraries](/l4/reference/libraries.md)

Core libraries shipped with L4:

- **prelude:** Standard functions (auto-imported)
- **daydate:** Date calculations and temporal logic
- **time:** Wall-clock time-of-day operations
- **datetime:** Absolute points in time with timezones
- **timezone:** IANA timezone constants
- **excel-date:** Excel date compatibility
- **math:** Mathematical functions
- **currency:** Currency handling (ISO 4217)
- **legal-persons:** Legal entity types and capacity
- **jurisdiction:** Jurisdiction definitions
- **holdings:** Holdings and ownership
- **actus:** ACTUS financial contract types and evaluation
- **llm:** LLM API integration
