remin


Name

remin -- produce minimal parenthesization of a regular expression

Synopsis

remin re

remin <re


Description

remin produces the minimal parenthesization of re, and applies some simple heuristics for minimizing the expression (removes subexpressions that are catenated with the empty set, removes the empty string from catenations, and removes redundant subexpressions in unions).

Any other Grail filter for regular expressions will remove superfluous parenthesis, simply by virtue of reading and writing an expression.

re must conform to the Grail format for regular expressions.


Examples

% cat re1
{}

% remin <re1
{}

% cat re2
""

% remin re2
""
% cat re3
(a+b)*abc

% remin re3
(a+b)*abc

% cat re4
(((a)+(b))*)

% remin re4
(a+b)*


Authors

Darrell Raymond and Derick Wood, the Grail project

See also

re(5)