Definite Clause Grammar - Other Uses

Other Uses

DCGs can serve as a convenient syntactic sugar to hide certain parameters in code in other places besides parsing applications. In the programming language Mercury, which borrows DCG syntax from Prolog, for example, DCGs can be used to hide io__state arguments in I/O code. They are also used in other, similar situations in Mercury.

Read more about this topic:  Definite Clause Grammar