The NOT construct

I have informally convinced myself that the NOT proposal by 'alfsb' 
(https://github.com/invisibleXML/ixml/issues/249#issuecomment-2549656848):

* Is functionally equivalent to the subtraction proposal, but 
computationally more efficient. (Because with subtraction, both parts are 
always tried, but with 'not', the second is tried only if the first fails.) 

* Can be implemented in all general parsing algorithms.
* Solves the problem without the need of the complication of a lexer stage 
(which would need a similar mechanism anyway).
* Is pleasantly declarative.

EXAMPLE

identifier: !keyword, [L]+.
keyword: "if"; "then"; "else"; "begin"; "end".

I think we should study it further.

Steven

Received on Tuesday, 7 January 2025 12:46:41 UTC