The ppRegExp functor


Synopsis

signature PPREGEXP
functor ppRegExp (NAMES) : PPREGEXP

This functor generates printing functions for regular expressions, using the printnames for constants and variables provided by the argument structure.


Functor result interface

include REGEXP_WEAK
eqtype alph
val printExp : alph re -> unit

Description

eqtype alph

printExp r
prints the regular expression r. Replaces Plus by "+", Times by ";", Star by "*" in infix resp. postfix notation, omits the Var and Atom constructors using the printnames, and prints brackets only where necessary.


See Also

NAMES

Discussion

Note: Printing long expressions does not introduce line breaks or indenting, so it's not a very `pretty' printing.

Example:
- structure ppE = ppRegExp(StandardNames); open ppE;
  printExp (Times [Atom "ab",Atom "cd",Plus[Atom "a",Plus[]],Star (Atom "ef"),Times[]]);

ab;cd;(a + 0);(ef)*;1

- printExp (Powers (Atom "a") 3);

(a;a;a + a;a + a + 1)