Replies: 2 comments 1 reply
-
I think this is better then DCG, because with this very simple representation it would be possible to implement more interesting functionality: union and intersection of multiple regexes, conversion from NFA to DFA, visualization, maybe even finding the smallest regex that can describe a given string... |
Beta Was this translation helpful? Give feedback.
-
This can never be used together with
or
Also termination considerations are much more complex with rational trees since the natural numbers can no longer be used to model terms. Much more complex means, there are no termination inferencers/analyzers ready to use. A couple of papers, no more than that. Such "clever" implementations just limit the application area. Think of the current CHR implementation in SWI that uses also such infinite terms internally. |
Beta Was this translation helpful? Give feedback.
-
Rational trees (aka cyclic terms) are closely related to finite automata, and so are regular expressions. Here is a quick sketch of pure Prolog implementation of regexes:
What do you think? Is it a good approach to implement regular expressions?
Beta Was this translation helpful? Give feedback.
All reactions