Skip to content
Brent Yorgey edited this page May 14, 2024 · 12 revisions

The Swarm codebase has gotten large enough to be quite intimidating at first glance (currently, as of May 2024, 28K SLOC across 224 modules). This page contains a (work-in-progress) guide to help orient developers to the codebase.

To help with organization and enforce modularity, the codebase is first broken into a number of sublibraries, listed below. Click on a sublibrary to jump to the section outlining its contents.

swarm-util

The swarm-util sublibrary contains various miscellaneous utilities which are used throughout the Swarm codebase.

swarm-lang

The swarm-lang library contains definitions and tools for working with the Swarm programming language.

  • Syntax
  • Parsing
    • Swarm.Language.Parser: defines top-level function readTerm for parsing an expression of the Swarm language, returning an AST annotated with source locations and comments.
    • Swarm.Language.Parser.*: various components of the parser:
      • Util: parsing utilities
      • Core: core parser definitions + utilities
      • Lex: lexing/tokenizing
      • Record: parsing records at both the type and term level
      • Type: parsing Swarm language types
      • Term: parsing Swarm language terms
      • Comment: re-inserting comments into the parsed AST
    • Swarm.Language.Key: data type, parsing + pretty printing for keys (i.e. key presses).
  • Checking
  • Elaborate
  • Pipeline
  • Pretty
  • Value
  • Swarm.Language.LSP

swarm-scenario

swarm-engine

swarm-doc

swarm-tui

swarm-web