JaggerScript / docsProject documentation

Reference

Grammar and Surface Semantics

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

The grammar is PEG-based and statement-oriented. A source file is a sequence of class declarations and comments. Class bodies contain field definitions, functions, and a constructor. Function bodies contain definitions, reassignment, function calls, object construction, conditionals, loops, break, and return.

P::=(Class∣Comment)∗P ::= (Class \mid Comment)^{*}
Program grammar. The parser accepts a program as a flat sequence of class declarations and comments.
Class::=class  C  {Definition∗  Function∗  Constructor?}Class ::= \texttt{class}\;C\;\{ Definition^{*}\;Function^{*}\;Constructor?\}
Class grammar. Classes own global definitions, functions, and an optional constructor body.
class Counter {
  number value = 0;

  constructor(number start) {
    value = start;
  }

  func next() {
    value = value + 1;
    return value;
  }
}
Representative program. The language keeps class structure explicit while using compact imperative statements inside functions and constructors.

Arithmetic expressions use conventional precedence by parsing additive tails over multiplicative terms. Boolean expressions compare two expressions with relational or equality operators. Function calls and scoped variables share the same scope prefix representation, which lets method calls and member access reuse the same scope-walk machinery.