![L4 Logo](/doc-images/l4.svg)

# L4 Language Documentation

Welcome to the L4 language documentation. L4 is a domain-specific language for law that enables computer-readable formalizations of contracts, legislation, and regulations.

---

## Getting Started

New to L4? Start here:

1. **[Get L4](https://marketplace.visualstudio.com/items?itemName=Legalese.l4-vscode)** - Download the L4 VS Code extension with Copilot and Claude Code integration
2. **[Your First L4 File](/l4/tutorials/getting-started/first-l4-file.md)** - Hands-on in 15 minutes
3. **[Composing L4 with AI](/l4/tutorials/llm-integration/composing-l4-with-ai.md)** - Draft L4 from prose using Claude Code
4. **[Foundation Course](/l4/courses/foundation.md)** - Learn L4 systematically

---

## Documentation Types

Our documentation is organized by **what you need**:

| Type                                 | Purpose                | When to Use                 |
| ------------------------------------ | ---------------------- | --------------------------- |
| **[Courses](/l4/courses.md)**     | Learning-oriented      | "Teach me L4"               |
| **[Tutorials](/l4/tutorials.md)** | Task-oriented          | "How do I do X?"            |
| **[Reference](/l4/reference.md)** | Information-oriented   | "What is X?"                |
| **[Concepts](/l4/concepts.md)**   | Understanding-oriented | "Why does X work this way?" |

---

## Courses

Structured learning paths from beginner to advanced:

### [Foundation Course](/l4/courses/foundation.md)

Learn L4 from scratch. No prior programming experience required.

- Module 0: Introduction - What is L4?
- Module 1: Your First Legal Rule
- Module 2: Legal Entities and Types
- Module 3: Control Flow
- Module 4: Functions
- Module 5: Regulative Rules (Obligations & Permissions)
- Module 6: Capstone Project

**Time:** ~4-6 hours total

### [Advanced Course](/l4/courses/advanced.md)

Deep dives for production use.

- Module A1: Real Regulatory Schemes
- Module A2: Cross-Cutting Concerns
- Module A3: Complex Contracts
- Module A4: Production Patterns

**Prerequisites:** Foundation Course

---

## Tutorials

Task-focused guides for specific goals:

### Getting Started

- [Your First L4 File](/l4/tutorials/getting-started/first-l4-file.md) - Create, run, test (15 min)
- [Encoding Legislation](/l4/tutorials/getting-started/encoding-legislation.md) - Turn legal text into L4 (30 min)
- [Wedding Vows Example](/l4/tutorials/getting-started/wedding-vows.md) - Fun intro to regulative rules (20 min)
- [Common Patterns](/l4/tutorials/getting-started/common-patterns.md) - Quick reference (30 min)

### Deployment and Legalese Cloud

- [Exporting Functions for Deployment](/l4/tutorials/deploying-functions/exporting-functions-for-deployment.md) - Deploy L4 rules as REST APIs and use with WebMCP (30 min)

### LLM Integration

- [Getting Started with LLM](/l4/tutorials/llm-integration/llm-getting-started.md) - Hybrid AI + formal reasoning
- [Legislative Ingestion](/l4/tutorials/llm-integration/legislative-ingestion.md) - LLM-assisted encoding

[View all tutorials →](/l4/tutorials.md)

---

## Reference

Look up specific features:

- **[Syntax Reference](/l4/reference/syntax.md)** - Complete syntax guide
- **[Types](/l4/reference/types.md)** - L4 Types
- **[Functions](/l4/reference/functions.md)** - Functions as rules
- **[Regulative](/l4/reference/regulative.md)** - Regulative language
- **[Libraries](/l4/reference/libraries.md)** - Standard library
- **[Operators](/l4/reference/operators.md)** - Operators and precedence

[View full reference →](/l4/reference.md)

---

## Concepts

Understand the "why" behind L4:

- **[Design Principles](/l4/concepts/language-design/principles.md)** - Why L4 works this way
- **[Regulative Rules](/l4/concepts/legal-modeling/regulative-rules.md)** - Obligations, permissions, prohibitions
- **[Algebraic Types](/l4/concepts/type-system/algebraic-types.md)** - L4's type system

[View all concepts →](/l4/concepts.md)

---

## Community & Support

- **[Discord](https://discord.gg/Q7a7NSEdNy)** - Chat with the community
- **[GitHub Issues](https://github.com/smucclaw/l4-ide/issues)** - Report bugs, request features
- **[Legalese Services](https://legalese.com)** - Professional implementation services

---

## Developer Resources

- **[Latest Stable Build](https://github.com/smucclaw/l4-ide/releases)** - [![L4-IDE](https://img.shields.io/github/v/release/smucclaw/l4-ide?color=brightgreen&logo=github&label=L4-IDE)](https://github.com/smucclaw/l4-ide/releases/latest)
- **[L4 IDE Repository](https://github.com/smucclaw/l4-ide)** - Open-Source code

---

L4 is published under the [Apache-2.0 License](https://github.com/smucclaw/l4-ide/blob/main/LICENSE).
