MCPcopy Create free account
hub / github.com/cortex-js/compute-engine / constructor

Method constructor

src/compute-engine/index.ts:503–578  ·  view source on GitHub ↗

* Construct a new `ComputeEngine` instance. * * Symbols tables define functions, constants and variables (in `options.ids`). * If no table is provided the MathJSON Standard Library is used (`ComputeEngine.getStandardLibrary()`) * * @param options.precision Specific how many digits of

(options?: {
    libraries?: readonly (string | LibraryDefinition)[];
    precision?: number | 'machine';
    tolerance?: number | 'auto';
    latexSyntax?: ILatexSyntax;
    latexOptions?: Partial<ParseLatexOptions & SerializeLatexOptions>;
  })

Source from the content-addressed store, hash-verified

501 11: null,
502 12: null,
503 36: null,
504 };
505
506 /** @internal Interned `BoxedType`s for primitive type names (P-BOX).
507 * Primitive names can never be shadowed by a user-declared type, so a
508 * per-engine singleton is safe — and identity-stable, which keeps caches
509 * keyed on `BoxedType` identity (e.g. the R-D5 display projection) from
510 * missing on every `engine.type('number')`. */
511 private _commonTypes = new Map<string, BoxedType>();
512
513 /**
514 * The stack of evaluation contexts.
515 *
516 * An **evaluation context** tracks the current lexical scope and
517 * assumptions. Symbol values are stored in their definitions, not here.
518 */
519 _evalContextStack: EvalContext[] = [];
520
521 /** The current evaluation context */
522 get context(): EvalContext {
523 return this._evalContextStack[this._evalContextStack.length - 1];
524 }
525
526 get contextStack(): ReadonlyArray<EvalContext> {
527 return [...this._evalContextStack];
528 }
529
530 set contextStack(stack: ReadonlyArray<EvalContext>) {
531 this._evalContextStack = [...stack];
532 }
533
534 /** The engine-level type registry: one namespace of declared types per
535 * engine, world state alongside symbol assignment. Types are NOT lexically
536 * scoped (`docs/TYPE-SYSTEM.md`).
537 * @internal */
538 readonly _typeRegistry: Record<string, TypeReference> = Object.create(null);
539
540 /** The engine-level PROTOCOL registry — the second kind of registry entry
541 * (`docs/TYPE-SYSTEM.md`), engine-global for the
542 * same reason types are: a conformance is a fact about a TYPE, not about a
543 * position in a scope chain. Protocol names are NOT types (P8).
544 * @internal */
545 readonly _protocolRegistry: Record<string, ProtocolRecord> =
546 Object.create(null);
547
548 /** Backing store for {@link _conformanceVersion}. */
549 private _conformanceVersionCounter = 0;
550
551 /** See `IComputeEngine._conformanceVersion`. @internal */
552 get _conformanceVersion(): number {
553 return this._conformanceVersionCounter;
554 }
555
556 /** See `IComputeEngine._noteConformanceRegistryChange`. @internal */
557 _noteConformanceRegistryChange(): void {
558 this._conformanceVersionCounter += 1;
559 }
560

Callers

nothing calls this directly

Calls 8

_resetMethod · 0.95
pushScopeMethod · 0.95
declareTypeMethod · 0.95
bootstrapLibrariesMethod · 0.95
hidePrivatePropertiesFunction · 0.90
registerDefaultsMethod · 0.80

Tested by

no test coverage detected