MN 113-8: Primmel Symbol Registry

#<Coradoc::CoreModel::CommentLine:0x00007fd967872ee8> #<Coradoc::CoreModel::CommentLine:0x00007fd967872948> #<Coradoc::CoreModel::CommentLine:0x00007fd967872628> #<Coradoc::CoreModel::CommentLine:0x00007fd967872308> #<Coradoc::CoreModel::CommentLine:0x00007fd967871bd8> #<Coradoc::CoreModel::CommentLine:0x00007fd9678710e8>

1. Symbols overview

1.1. General

The symbol registry provides typed, unit-aware formal symbol definitions with LaTeX rendering hints and normative traceability. Symbols are referenced from OCL expressions inside calculations and form evaluation rules.

1.2. Why symbols exist

Without a symbol registry, OCL expressions reference bare identifiers with no type checking, no unit validation, and no documentation hint. For technical standards with many symbols (OIML R 60 has ~50), this leads to:

  • Typos that silently evaluate to null
  • Unit mismatches that produce wrong results
  • Documentation that drifts from the implementation
  • No traceability from a symbol back to its normative definition

The symbol registry solves all four problems.

1.3. Relationship to other Primmel constructs

Construct Relationship
measurement Measurements are runtime values; symbols are their formal types.
calculation Calculations reference symbols by name in their expression .
form Form fields can reference symbols; calculation bindings resolve to symbols.
reference Symbols link to normative sources via reference { } .

1.4. Identifier conventions

Symbol identifiers should match the printed standard's notation where possible. For Unicode-friendliness:

  • Use ASCII letters and digits: f, nLC, Emax, MPE, C_C, C_DR
  • Use underscore for subscripts that don't render well as plain letters: C_C, C_DR, C_M
  • Reserve capitalization for quantities ( Emax, MPE); lowercase for variables ( f, n, p_LC)
  • The latex property provides the formal rendering for documentation

2. Symbol syntax

2.1. General

A symbol declaration uses the symbol keyword followed by an identifier and a brace-delimited body.

2.2. Syntax

symbol <SymbolID> {
  name "Human-readable name"
  definition "Formal definition"
  type <SymbolType>
  unit "<unit>"
  latex "<LaTeX rendering>"
  reference { <ReferenceID> }
}
  1. Display name. Required.
  2. Formal definition. Optional but recommended.
  3. Type: number, integer, string, boolean, or enum.
  4. Unit annotation. Optional (dimensionless = ”1“).
  5. LaTeX rendering hint for documentation. Optional.
  6. Normative references. Optional.

2.3. Properties

Property Required Description
name yes Human-readable name.
definition no Formal definition.
type yes One of number , integer , string , boolean , enum .
unit no Unit annotation. Defaults to ” 1 “ (dimensionless).
latex no LaTeX rendering hint. Defaults to the identifier.
reference no Normative references for traceability.

2.4. Example: OIML R 60 symbols

symbol f {
  name "Conversion factor"
  definition "Ratio of indication change to load change at 75% of Max. Converts counts to verification units (v)."
  type number
  unit "counts/v"
  latex "f"
  reference { R60-3-2-1-2-4 }
}
symbol nLC {
  name "Maximum number of load cell verification intervals"
  definition "Declared by the manufacturer. Determines the MPE tier and run count."
  type integer
  unit "1"
  latex "n_{LC}"
  reference { R60-1-3-5-8 }
}
symbol Emax {
  name "Maximum capacity"
  definition "Upper bound of the measuring range."
  type number
  unit "kg"
  latex "E_{max}"
  reference { R60-1-3-3 }
}
symbol MPE {
  name "Maximum permissible error"
  definition "Tiered MPE values derived from p_LC and verification intervals."
  type number
  unit "v"
  latex "MPE"
  reference { R60-1-5-3-2 }
}

3. Types and units

3.1. General

Symbols are typed. The type system is intentionally minimal — five primitives that cover virtually all compliance use cases.

3.2. Allowed types

Type Description
number Floating-point or integer numeric value.
integer Whole number. Use for counts (e.g., n_LC ).
string Free-text value.
boolean True/false value.
enum Named value from a finite set. Use `values` block to declare allowed values.

3.3. Unit conventions

Units are free-form strings, but should follow SI conventions:

  • kg, g, t — mass
  • m, mm, μm — length
  • s, min, h — time
  • K, °C — temperature
  • V — voltage
  • A — current
  • Ω — resistance
  • % — percentage
  • 1 — dimensionless (default)
  • Compound: counts/v, kg/m³, m/s²

3.4. Unit compatibility

When a calculation input has a declared unit and a binding provides a different unit, the parser:

  • Allows dimensionless coercion ( ” 1 “ ↔ any unit)
  • Allows scale prefixes ( kg ↔ g with explicit conversion)
  • Rejects incompatible units ( kg ↔ V)

3.5. Default unit

If no unit is declared, the default is ” 1 “ (dimensionless). Dimensionless values can be bound to any unit without explicit conversion.

3.6. Enum values

For type enum , declare allowed values via the values property:

symbol accuracy_class {
  name "Accuracy class"
  type enum
  values [A, B, C, D]
  reference { R60-1-3-7-1 }
}

4. LaTeX rendering

4.1. General

The latex property provides rendering hints for documentation generators. It does not affect runtime behavior.

4.2. Syntax

The latex value is a string containing valid LaTeX math-mode markup. The documentation generator wraps it in \(...\) or \[ ... \] as appropriate.

4.3. Conventions

  • Use plain letters for variables: f, x, n
  • Subscripts: n_{LC}, E_{max}
  • Superscripts: x^2, 10^{-3}
  • Greek letters: \alpha, \beta, \Delta
  • Operators: \times, \cdot, \leq, \geq
  • Text in math: \text{MPE}, \mathrm{C_H}

4.4. Default behavior

If latex is omitted, the documentation generator uses the symbol's identifier verbatim.

4.5. Example

symbol C_C {
  name "Creep"
  type number
  unit "v"
  latex "C_C"
  reference { R60-1-5-5-1 }
}
symbol C_DR {
  name "Dead load output return"
  type number
  unit "v"
  latex "C_{DR}"
  reference { R60-1-5-5-2 }
}

Renders as C_C and C_{DR} (with subscript) respectively.

5. Cross-references

5.1. General

Symbols link to normative sources via the reference property. This provides traceability from the formal symbol back to its printed definition.

5.2. Syntax

symbol <SymbolID> {
  // ...
  reference { <ReferenceID> { <ReferenceID> } }
}

Multiple references are allowed. The first listed is the canonical source; subsequent ones are additional sources.

5.3. Resolving references

A reference { R60-3-2-1-2-4 } requires a top-level reference R60-3-2-1-2-4 { ... } declaration elsewhere in the model. The parser:

1. Collects all reference declarations 2. Validates that every symbol's reference { ... } points to a declared reference 3. Emits an error if a symbol references an undeclared source

5.4. Example

reference R60-1-5-3-2 {
  document "OIML R 60-1:2021"
  clause "5.3.2"
  title "Maximum permissible errors on type evaluation"
}
symbol MPE {
  name "Maximum permissible error"
  type number
  unit "v"
  reference { R60-1-5-3-2 }
}

5.5. Why this matters

The chain symbol → reference → external document enables:

  • Bidirectional search ("find all symbols defined in R 60-1 §5.3.2")
  • Compliance checking ("is every used symbol traceable to a normative source?")
  • Documentation generation (render a symbol index with citations)

6. Formal grammar

6.1. Symbol declaration

SymbolDecl   = "symbol" ID "{" { SymbolProperty } "}" ;
SymbolProperty = "name" STRING
               | "definition" STRING
               | "type" SymbolType
               | "unit" STRING
               | "latex" STRING
               | "values" "[" ID { "," ID } "]"
               | "reference" "{" { ID } "}" ;
SymbolType   = "number" | "integer" | "string" | "boolean" | "enum" ;

6.2. Lexical conventions

As per the forms grammar (see formal-grammar-forms ).

6.3. Top-level placement

SymbolDecl may appear at the top level of a model, alongside other declarations.