Documentation
Open-source core
The MathPets language, compiler, deterministic runtime and VS Code extension are developed in public under the Apache-2.0 licence. The hosted studio is a separate product built on that core.
Project boundary
A reusable toolchain, without the website
The public repository contains what you need to parse, compile and run a MathPets model in another host. It does not include this website, account integrations, hosted APIs or private product data.
That boundary keeps the core useful on its own: model files remain portable, compiler behavior is testable outside the Studio, and hosts can build their own interfaces around the same deterministic runtime.
Read the language reference here, or browse the public source on GitHub.
dependency direction
source.pet │ ▼language / compiler │ ▼model API │ ▼engine / runtime ▲ │host applicationsPortable format
One model, four files
Executable rules live in source.pet. The three companions are ordinary YAML, so catalog copy, presentation and parameter presets stay separate from simulation behaviour. MathPets Studio checks the four files together and catches broken state, field, monitor and parameter references before the model runs.
my-model/ source.pet executable model definition.petmeta title, description, topics, learning goal styles.petstyle colors, shapes, scales, transitions presets.petpreset named parameter configurationsPackages
What is in the core
packages/language
@pets/language
The Lezer grammar, parser, diagnostics and JavaScript emitter.
Browse package ↗packages/engine
@pets/engine
Deterministic worlds, geometry, seeded random streams, lifecycle control and indexed spatial queries.
Browse package ↗packages/model-api
@pets/model-api
The runtime-building API that compiled models call.
Browse package ↗packages/ide
MathPets for VS Code
Highlighting, completion, compile commands and a runtime-backed preview for .pet files.
Browse package ↗Local workflow
Test, compile and package
npm test regenerates the parser, builds the compiler bundle and runs the compiler and extension tests.
scripts/compile-model.mjs prints the compiled model: an ES module that exports createModel and imports the model API and engine packages. A host can create the model, set its seed, run setup and advance ticks without the studio.
core commands
npm installnpm test node scripts/compile-model.mjs path/to/model.pet > model.js npm run package:extensionRepository guides
Build with the core
Setup
Start here
Install the workspace, run the tests, compile a model and build the VS Code extension.
Read on GitHub ↗Syntax
Language reference
The source-language reference: worlds, patches, pets, links, actions, lifecycle sections and builtins.
Read on GitHub ↗Sidecars
Model files
How source.pet relates to its YAML sidecars for metadata, styles and presets.
Read on GitHub ↗Editor
VS Code extension
Features, running it from the workspace, and packaging and installing a VSIX.
Read on GitHub ↗