Snobol Patterns in Prolog II: Span with Count

In Arbno, the Cursor, and Snobol Patterns in Prolog, I showed how to implement Snobol pattern matching with Prolog Definite Clause Grammars (DCGs), listing the Prolog code for "any", "span", the "$" immediate-assignment operator, and two attempts at "arbno". Here is another pattern I've found useful, a "span" variant that also counts the characters matched. And I'd like to ask: what higher-order abstraction would you use to implement both this and the normal "span"?



January 28, 2010
URL:http://www.drdobbs.com/architecture-and-design/snobol-patterns-in-prolog-ii-span-with-c/228701256

Terms of Service | Privacy Statement | Copyright © 2024 UBM Tech, All rights reserved.