What does the EBNF production rule look like (and can you write that in EBNF?)
The set difference AB
between regular expressions is equivalent to intersection with a complement: A&~B
: the set of strings matched by A, devoid of any strings matched by B. Neither flex nor alex support such semantics in their regular expression languages.
An expression of this form still denotes a regular language, and therefore has an equivalent automaton, for which a regular expression exists based only on the alternation and Kleene operators. This equivalent expression not easy to find, and it depends on the specific internals of A and B. That is to say, we can't just plug A and B into some general regex formula such that the result denotes the set difference. The original A and B will not appear in the set difference regex.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…