Skip to content

SpecificationX · Errors and diagnostics

10.2

Severity and classes

Severity says what to do with a diagnostic: an error prevents running, a warning tells you and lets you continue.

Markdown version

10.2.1 How it works

Every code has a single severity, fixed in the catalogue and independent of its class. They are grouped by a letter:

LetterSeverityExamples
Astructural error or runtime failuremissingStatementTerminator, divisionByZero
Chygiene warningvariableDeclaredNeverUsed
Dinformationsuggestions without consequence
Erecoverable reading warningreadValueTypeMismatch

The letter B is not assigned.

Figure 10.2-1.Classes say in which phase the problem is detected; severity, what consequence it has.

At the top, the four classes in order: lexical, syntactic and semantic before running, and runtime during. Below, the four severity letters: A error, C hygiene, D information and E reading.

Classes follow the program's journey: lexical and syntactic while reading the text, semantic while checking types and names, and runtime while it runs. If there are lexical or syntactic errors, the semantic phase does not run: that way no errors derived from a broken tree appear.

A warning stops nothing. When reading a value that does not fit the type, the engine warns and asks again, without changing the variable:

ProgramA read that is repeated

Algorithm Edad
  Define edad As Integer;
  Read edad;
  Write "Tienes ", edad;
EndAlgorithm

Input

doce
12

Output

Tienes 12

Diagnostics

  • readValueTypeMismatch · warning · 3:3 · Expected a value of type Entero, and received doce

The program finishes normally.

In short

  • Every code has a fixed severity: A error, C hygiene, D information, E reading.
  • Classes give the phase: lexical, syntactic, semantic or runtime.
  • With syntax errors no semantic analysis is done.