library-folders.md 1.9 KB

Library folders — implementation note

Status: implemented (2026-10-24).

The former aggregate stdlib/ is retired. Libraries now live in dialect folders:

Folder Contents
runtime/syslib/ shared runtime: SysShim, FileIO, SysExceptions, Utf8
lib/common/ CharClass, Math, Storage, Strings, SysIO
lib/pim/ FpuIO, InOut, NumberIO, RealInOut, StrIO
lib/iso/ ISO 10514-1: IOChan, StreamFile, TextIO, STextIO, SWholeIO, SRealIO, WholeIO, RealIO, LongIO, LongWholeIO, Conversions, ConvTypes, IOConsts, SIOResult, RealStr, WholeStr, LongStr, LongMath, Files, ProgramArgs, SysClock, TERMINATION, EXCEPTIONS, M2EXCEPTION
lib/gm2/ optional gm2 compatibility: DynamicStrings, StdIO, SysStorage, TimeString, wrapc, wrapclock, wraptime

lib/common holds modules whose V3 implementation is genuinely shared; Strings is included there because it is a classic descriptor-string library used by both dialect tests. lib/gm2 is not a dialect: it is an optional compatibility set used by the corpus/tests. Do not mix lib/pim and lib/iso in one session.

Build and test selection

  • M2make --dialect pim|iso|gm2 adds lib/<dialect>, lib/common, lib/gm2 and runtime/syslib to module resolution.
  • tools/v3-corpus/corpus.sh chooses lib/iso for paths containing /iso/, otherwise lib/pim, and adds lib/common, lib/gm2 and runtime/syslib. V3_LIBS remains an explicit override.
  • compiler/run_tests.sh lists library files explicitly; all paths were migrated to lib/<dialect>/....
  • bootstrap/fixpoint.sh uses -I lib/common and runtime/syslib for the compiler (it imports Strings/Storage and the shared runtime).

The one-shot multi-file compilation model is unchanged; this is a directory/build-selection change, not separate compilation.