JaggerScript / docsProject documentation

Reference

Parser and Compiler Pass

Look up syntax, contracts, layouts, algorithms, and exact behavior.

The parser grammar is written in PEG form and emits plain parser nodes with token-type labels. A separate compiler pass converts those raw nodes into a typed program representation, turning a syntax-shaped tree into runtime-shaped data.

C:Aparse→PtypedC : A_{\mathrm{parse}} \rightarrow P_{\mathrm{typed}}
Frontend mapping. The compiler maps parser output into an explicit typed program structure consumed by the interpreter.

That division keeps the grammar from becoming the whole language implementation. Parsing answers whether the input has the right shape; compilation decides what each shape means to the interpreter.

The first major tradeoff is a normalization pass. A one-pass interpreter could walk the parser output directly, but parser helper nodes and incidental grammar structure would leak into runtime code. JaggerScript pays that extra pass so the interpreter can consume a smaller vocabulary whose nodes are named for behavior rather than syntax.

  • Raw nodes use names such as Class, Definition, Function, IfBlock, WhileLoop, FuncCall, and Primitive.
  • Compiled tokens use a smaller enum-like runtime vocabulary.
  • Expression conversion handles primitives, arithmetic expressions, boolean expressions, function calls, variables, and instantiation.
  • Comments are filtered from the executable program representation.