[Oberon] Non-matching expressions in case statements

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Thu Aug 31 06:43:02 CEST 2023

> My interpretation is that the presence of the phrase *case label list* indicates
> that the remainder of the sentence only applies to numeric case statements.
> The syntax for type case statements is a substantially reduced form of the
> syntax for numeric case statements:
> TypeCaseStatement = CASE qualident OF case {"|" case} END.
> case = [qualident ":" StatementSequence].
> NumericCaseStatement = CASE expression OF case {"|" case} END.
> case = [CaseLabelList ":" StatementSequence].
> CaseLabelList = LabelRange {"," LabelRange}.
> LabelRange = label [".." label].
> label = integer | string | qualident.

I agree. And this is not the only difference between the two
forms of the case statement. For example:

Although the semantics of what happens at run time, when
the value (or type) of the case expression (or case variable)
does not correspond to any case label (or case label type)
in the source text is NOT defined in the Oberon language,
an actual compiler implementation may choose two
different approaches, e.g.,

a. For the numeric case statement: the program is aborted
b. For the type case statement: no action is taken (e.g., to
    enable the "fall-through” mechanism in OO settings)

More information about the Oberon mailing list