FHERMA KERNEL LANGUAGE

Diagnostics

A declaration that parses is required to mean something: after parsing, the tools run the rules that need the whole declaration. tensor<N x banana> used to parse and fail much later as "banana is not a parameter" — true and unhelpful; it is now refused at the point of reading.

Every refusal carries a code, the place, and something to do about it:

$ fherma-lang parse bad.fhk
E-TYPE-1: Field is neither a class nor a type of this language
  line 1, column 13
  kernel f<T: Field>(%x: T) -> %y: T
              ^
  A value parameter takes a scalar type: i8, i16, i32, i64, u8, u16, u32,
  u64, f32, f64. Classes are Numeric, Integer, Real.

Codes exist so that tools can act without matching English text. The ones a signature author meets:

codewhat it refuses
E-SYN-1a syntax error
E-NAME-1a name declared twice in one namespace
E-NAME-2an identifier in type position that is not a declared parameter
E-NAME-3a dimension that is not a declared parameter
E-TYPE-1an integer width outside the set, or a bound of the wrong sort — a type after :, a class after =
E-TYPE-2a floating-point width outside f32, f64
E-TYPE-3tensor or secret as a tensor's element
E-TYPE-4secret nested in secret
E-TYPE-5a retired value word — uint, int, real — anywhere, or a signed or real parameter used as a dimension
E-TYPE-6a tensor with no dimensions
E-SPEC-3a parameter left open where it must be concrete — a bare name, a value written with =, or a class where a settled type is required
E-SPEC-4a ? dimension surviving into a specification

The E-REFINE family compares a specification against the kernel it names — order preserved, secrecy unchanged, classes satisfied — and is the platform's check at submission time; see Refinement.

The vocabulary, as data

Anything with a type picker needs the list of types, and a copied list goes stale. The tool prints its closed vocabularies as JSON instead:

fherma-lang vocabulary

Scalar types with widths and signedness, the value types a parameter may range over, and which scalars satisfy which class — derived by asking the language, not by listing it a second time. The platform's own signature editor reads this rather than keeping a copy.