isoebnfebnf-syntactic-exception

Contents of exceptions in ISO EBNF


In the ISO 14977 EBNF standard, section 4.7, the legal contents of an exception is described. I'm fairly certain that an exception may consist of any valid syntactic factor, as long that it doesn't contain any meta-identifiers. Which means that could use a special sequence as an exception like this

syntax =
    my rule - ? Something clever ? ;

Is this the case?

You can get the standard for free at ISO here.


Solution

  • No that is not correct. You can use meta-identifiers in an exception as long as when fully evaluated they result in terminals. The example given in section 4.7 shows a meta-identifier defined in terms of itself, which can never fully resolve to a terminal. That is what they mean when they say:

    ...could equally be represented by a syntactic-factor containing no meta-identifiers.

    There are lots of examples of this in the standard itself - checkout section 8. For example:

    gap free symbol = terminal character - (first quote symbol | second quote symbol)