Lessons

lesson 14 / 15

Entry points and embedding

main is only a convention used by this tutorial. An embedding project can choose another entrypoint, such as build, prepare, or package.

The reference interpreter follows this general flow:

  1. Tokenize the source.
  2. Parse tokens into an abstract syntax tree.
  3. Create an execution context.
  4. Load variables and functions into that context.
  5. Execute the selected function.

The execution context contains variables, functions, the current directory, and optional hooks. Hooks let a project provide behavior that should not be part of the language itself, such as process execution, macros, logging, or a virtual filesystem.

This separation is what lets the same language work in kpkg, Jumpstart, and a browser tutorial with different capabilities.