Skip to content

[General]: The manual's try-catch grammar uses with, but every try statement uses catch #104

Open

Description

@shuklaayush

Problem

The manual's grammar (ISA_LRM, "Throw and Try-catch statements") is

catch-statement =
'try'
    statement-list
'with'
    { 'when' pattern [ guard ] '=>' statement-list }
'endtry' ';'

The specification uses catch, not with, and binds the exception as
identifier : type. All 18 try statements in the sources have this form, e.g.
Handle_Exception:

try
    …
catch
    when e : Exception_Info =>
        …
    when e : Instruction_Ended =>
        // do nothing
endtry;

The manual's pattern grammar (ISA_LRM, "Patterns", irrefutable and refutable
patterns
) has no identifier : type form, so when e : Exception_Info is not a pattern. reading-specs.md gives a
third form, try <statements> catch x {when <identifier> : <type> => <statements>} [otherwise => <statements>] endtry;, with an x after catch that no source uses.

Proposed fix

In the manual:

catch-statement =
'try'
    statement-list
'catch'
    { 'when' identifier ':' type [ guard ] '=>' statement-list }
'endtry' ';'

In reading-specs.md, remove the x after catch.

AI disclosure

Assisted-by: Claude

Claude assisted with source analysis, the proposed correction and drafting this report.
Reviewed with assistance from Codex.

Pinned source: definitions.xml.gz at revision 35eface1b7ee003a1cda95005ec5fd83de658a64.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions