4.3.10. Try Rule

[Tip]Description

The try rule is used for catching the failure of a rule (similarly to catching an exception in traditional programming languages).

[Important]Syntax
TryRuleAST ::= try AsmRuleAST
             | try AsmRuleAST else AsmRuleAST

The try rule has a mandatory (body) and an optional (else) ASM rule.

[Note]Semantics

The try rule attempts to execute its body rule (the first ASM rule), and executes the else part (the second ASM rule) if the execution of the body rule fails. It is conceptually similar to exception handling in Java (but without finally block).

Remark.  A rule can fail in the following situations:

Defined In:  compound rule

See Also:  fail rule, choose rule, iterate rule, if rule