Contributors · Internals

Codebase map

The source tree is easier to read once you separate the symbolic core, the mathematical domains, and the public subpath façades. Most debugging starts by identifying which of those layers owns the behavior you are seeing.

The top-level directories

core/

The symbolic object model and shared machinery: parser, expressions, equations, vectors, matrices, rationals, converters, settings, errors, dispatch, and core helper functions.

algebra/

Factoring, simplification, GCD/LCM, partial fractions, polynomial conversion, Gröbner work, and supporting algebraic algorithms.

calculus/

Differentiation, integration, limits, Laplace transforms, and calculus-specific helpers and tables.

math/

Common mathematical functions, special functions, trigonometry, geometry, truncation, and numerical helpers used by notation and algorithms.

solve/

Equation solving, systems, solver classes, root handling, and SolutionSet.

api/

Public subpath entry files such as nerdamer/algebra, nerdamer/calculus, nerdamer/parser, and nerdamer/structures. These expose selected source functionality; they are not the implementation domains themselves.

utils/

Reusable lower-level utilities shared across the implementation, including debugging helpers.

index.ts

The complete-package entry point. It calls registerNerdamerFunctions(), exports the callable Nerdamer API, and attaches selected higher-level operations to core classes.

A useful way to read src/core

src/core/
├─ classes/
│  ├─ expression/      central symbolic scalar representation
│  ├─ parser/          tokenization, RPN, operators, scripting
│  ├─ equation/        LHS/RHS equation structure
│  ├─ rational/        exact rational arithmetic
│  ├─ vector/          ordered aggregate + vector operations
│  ├─ matrix/          matrix representation and operations
│  ├─ valuesSet/       finite set semantics
│  └─ ...
├─ converters/         text and TeX conversion
├─ functions/          shared symbolic functions
├─ dispatch.ts         shared parser function registry and entry shape
├─ parserFunctions.ts  parser/core + math registration
├─ fullFunctions.ts    complete CAS registration composition
├─ Settings.ts         shared parser/engine settings
├─ errors.ts           typed errors and messages
└─ types.ts            ExpressionInput, NerdamerInput, ParserEntity

Parser registration is composed by the entry point

dispatch.ts owns the shared function registry, but it no longer imports every mathematical domain. Registration is split across domain dispatch modules and composed at the package boundary.

Parser packagesrc/api/parser.tsloadParserFunctions()

Loads scripting, assumptions, structures, complex, polynomial, and math functions without importing algebra, calculus, or solving.

Complete packagesrc/index.tsregisterNerdamerFunctions()

Adds the algebra, calculus, and solve registrations needed by complete Nerdamer notation.

Shared registrysrc/core/dispatch.ts

Stores the registered functions consumed by parser dispatch.

Implementation directories are not the same as import paths

A newcomer can easily confuse src/algebra with the package subpath nerdamer/algebra. The first contains implementation code. The second is assembled through a small façade in src/api/algebra.ts that exports the supported API for consumers.

Implementationsrc/algebra/

Algorithms and internal supporting code.

Façadesrc/api/algebra.ts

Selects what the package subpath exposes.

User importimport { factor } from 'nerdamer/algebra'

The supported package-facing entry point.

Follow the data, not just the imports

Many features cross module boundaries. A solver may call algebra helpers; calculus works on the same Expression representation as factoring; a parser-visible function may be defined by a domain dispatch module and stored in the shared registry while its implementation lives elsewhere. When tracing behavior, identify the object being passed between layers and follow that object.

Browse the source tree

The current src directory is the authoritative map for implementation ownership.

nerdamer/src
Understand the object being passed

Read the expression model next if the representation itself is still unfamiliar.

Expression model