Class Symbols

java.lang.Object
org.clafer.frontend.Symbols

public final class Symbols extends Object
The symbols of a model, the first pass after the parser: a symbol per clafer, with its UID, its parent, its super clafer, the type of its reference, its card and group card with the defaults applied, its temporal modifiers and the clock of its initializer. An enumeration declares a symbol for itself and one for each literal. The tree is not changed: the symbols are found by their declarations.

The rules are those of the Clafer compiler, in the order it applies them: the desugarer (Desugarer.hs: enumerations, clafer uses, a primitive super, a reference to a constant), the UIDs (UIDs.hs), the supers (ResolverInheritance.resolveNModule, with the relocation of a top-level abstract clafer that extends a nested one, gsdlab/clafer#67), the references (resolveOModule), and the defaults of the cards (analyzeModule). A reference's target is resolved as the compiler resolves it: by a name, a path of names, or a set expression whose type is the primitive of its values or the nearest common super of its clafers. The names inside constraints are the next pass.

  • Method Details

    • analyze

      public static Symbols.Result analyze(Syntax.Model model)
      Parameters:
      model - a parsed model
      Returns:
      its symbols
    • outline

      public static String outline(Symbols.Result symbols)
      The clafers as the explicit form declares them, without their constraints and the values of their initializers: one line per clafer, [abstract] [modifiers] gcard uid [: super] [-> type] card [init], its subclafers indented under it, and an enumeration as enum E = a | b. It is what the symbols say about a model, and outline(Ir.Model) gives the same for an explicit model.
      Parameters:
      symbols - the symbols of a model
      Returns:
      its outline
    • outline

      public static String outline(Ir.Model model)
      Parameters:
      model - an explicit model
      Returns:
      its outline, as outline(Result)