Phrase Support for DCGs

Author(s): Jose F. Morales, The CLIP Group.

This library extends the DCG package (dcg) with support for the phrase/2 and phrase/3 predicates.

Those predicates allow the translation and execution of arbitrary terms as DCGs goals at runtime. Those features, are not always desirable, since arbitrary code execution can negatively affect the precision of static analysis and increasing the size of static executables. This package offers a method to include runtime support for DCGs only when necessary.

Usage and interface

Known bugs and planned improvements

  • Runtime support could be included automatically when required. However, detecting if phrase/2 or phrase/3 are necessary is harder. It could be implemented just by detecting if call/N is visible and runtime expansions are required in the module.