A Prolog system for processing Perl style regular expressions can be implemented via the following steps.
- Defining the BNF grammar of Perl-style regular expressions.
- Defining a Prolog representation of Perl regular expressions.
- Build a DCG parser for Perl regular expressions.
- Building a regular expression matcher in Prolog.
This is a useful case study of symbolic computing in Prolog and also an exploration of the semantics of regular expressions.
This seems like fun. It connect well with our recent discussions of SNOBOL, Icon and Rexx.
Notice, once more, that we should be careful with the term 'regular expressions.' When you start adding things like backtracking, and context you soon exceed the power of what computer science calls REs.
There are several beautiful SNOBOL examples showing how SNOBOL pattern matching can be used for recognizing CFLs.
Posted to "" by Ehud Lamm on 1/20/01; 3:43:05 AM
|