Skip to content

Architecture

Leonard Ramminger edited this page Aug 31, 2026 · 1 revision

Architecture

prebyte-engine is the templating core extracted from the Prebyte CLI. It owns parsing, compilation, rendering, Lua, and embed APIs.

Modules

  1. config/ — settings, profiles, rules, variable imports
  2. io/ — input and output helpers
  3. template/lexer/ — tokens
  4. template/parser/ — recursive-descent parser
  5. template/ast/ — typed AST nodes
  6. runtime/ — renderer, compiled executor, include resolver, value resolution, Lua runtime
  7. support/ — diagnostics and spans
  8. datatypes/ — shared value and type helpers

Public entry points:

Header Role
PrebyteEngine.h High-level session API
Engine.h Low-level compile/render API
prebyte_engine.h C FFI

Execution path

  1. source lexed into tokens
  2. parser builds AST
  3. compiler emits CompiledProgram
  4. executor renders program with scoped variables, functions, includes, and Lua support

Compiled template files

  1. .pbt — source template
  2. .pbc — compiled cache

Library targets

Target Alias Description
prebyte_engine_static prebyte::engine_static Static library
prebyte_engine prebyte::engine Shared C++ library
prebyte_engine_c prebyte::engine_c C FFI shared library

The Prebyte CLI adds cli/ and app/ on top of this engine.

Clone this wiki locally