Prolog and Regular Expressions
-
at http://www.let.rug.nl/~vannoord/prolog-rx/
there is a very simple straightforward interface to the ISO regular
expression functions regcomp(3), regexec(3), regfree(3),
regerror(3). Tested for SICStus Prolog, should work for Prologs with
similar foreign language interface. GPL.
- two similar implementations are available from
- similar functionality is built-in in IF-Prolog, for info consult
http://www.ifcomputer.de/Products/IFProlog/home_en.html
- recent versions of YAP include a regular
expression library.
- it's also present in XPCE, which is a graphical user-interface
sometimes used with SWI-Prolog.
http://www.swi-prolog.org
- Ciao Prolog (Gnu-copyright) has a library for regular expression
matching.
http://clip.dia.fi.upm.es/Software/Ciao/.
- K-Prolog has regular expressions too. http://prolog.isac.co.jp/doc/en/feature/reg_match.html
- MINERVA has regular expressions too, cf
http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/regexp/ .
MINERVA (proprietory, commercial, ISO-Prolog compiler in 100% Java)
home is
http://www.ifcomputer.co.jp/MINERVA.
- there is also a large package with finite-state utilities, all
implemented in SICStus Prolog, called FSA Utilities. It contains a
regular expression compiler, all kinds of operations on finite
state acceptors, weighted finite-state acceptors and finite state
transducers. Operations include determinization, minimization,
visualization etc. There is support to add your own regular expression
operators. Etc. Etc.
The latest addition is a compiler of sequential (`deterministic') finite
state transducers into a C program which computes the transduction (line
by line). It's about 100 times faster than the built-in transduction
option of FSA. Available (GPL) from
http://www.let.rug.nl/~vannoord/Fsa/
there is a very small and very experimental web demo at
http://www.let.rug.nl/~vannoord/fsademo/
the user manual is available as
http://www.let.rug.nl/~vannoord/Fsa/Manual/
- another implementation of (extended) regular expressions in Prolog is
Regi.
- XSB Prolog. There is a chapter in the XSB book on how to do
automata theory in XSB.
- A page entitled Perl Style Regular Expressions (in Prolog).
- if you're looking for a lex-like tool, you might consider Elex. Elex
is a lexical analyzer generator with multiple output languages. There
is a version which produces Prolog lexers at
http://www.let.rug.nl/~vannoord/Elex/
The original Elex homepage is at
http://www.ozemail.com.au/~mpp/elex/elex.html
So this is not implemented in Prolog (in C++ and Perl, rather), but
can be made to produce Prolog output (tested with SICStus, SWI,
BinProlog, Bprolog; should work for others).
- another lexer with Prolog output (implemented in Prolog) is part
of multiplex by Peter Reintjes (for Quintus prolog).
http://frege.als.com/nalp/people/Reintjes_Peter/Reintjes_Peter.html