Project Structure

January 16, 2026 · View on GitHub

This document describes the directory structure and organization of the LeanCLR project.

Overview

leanclr/
├── src/
│   ├── runtime/      # LeanCLR runtime core
│   ├── libraries/    # Base class libraries
│   ├── tools/        # Command-line tools
│   ├── samples/      # Sample projects
│   └── tests/        # Unit tests
├── docs/             # Documentation
└── tools/            # Build utilities

Note: Demo examples have been moved to a separate repository: leanclr-demo


src/runtime (Runtime Core)

Directory: src/runtime

Core implementation of the LeanCLR runtime. This is the heart of the project.

DirectoryDescription
metadataECMA-335 metadata parsing and representation
vmVirtual machine core (type system, method invocation, runtime state management)
interpIL interpreter and IR interpreter implementation
gcGarbage collector (in development)
icallsInternal calls implementation
allocMemory allocators (metadata allocation, managed object allocation)
intrinsicsIntrinsic method implementations
osOS abstraction layer
utilsUtility functions and helpers
miscMiscellaneous components

src/libraries (Base Class Libraries)

Directory: src/libraries

Contains .NET Framework base class libraries required by the runtime:

  • mscorlib.dll - Core runtime library
  • System.dll - System namespace types
  • System.Core.dll - LINQ and additional system types

Note: Only .NET Standard 2.x / .NET Framework 4.x core libraries are verified.


src/tools (Command-Line Tools)

Directory: src/tools

lean

A command-line tool with embedded LeanCLR runtime that can directly load and run .NET assemblies.

Basic Usage:

lean [options] <dll_name> [-- <dll_args>...]

Options:

OptionDescription
-l, --lib-dir <dir>Add a DLL search path (can be used multiple times)
-e, --entry <entry>Specify entry method in format Namespace.Type::Method
-h, --helpDisplay help information

Example:

lean -l dotnetframework -l libs CoreTests -e test.App::Main

src/samples (Sample Projects)

Directory: src/samples

ProjectDescription
startupWin64 native platform sample project
lean-wasmWebAssembly platform sample project

src/tests (Unit Tests)

Directory: src/tests

Unit test framework and test cases for the LeanCLR runtime.

DirectoryDescription
basic_test_runnerC++ test runner (loads and executes managed test assemblies)
managedC# managed test projects

See Test Framework Documentation for details on how to add test cases.


docs (Documentation)

Directory: docs

Project documentation including build guides, embedding instructions, and API references.


tools (Build Utilities)

Directory: tools

Build and development utilities:

  • clang-format - Code formatting configuration