Prolog DCG "distilled" - Part 1
Introduction Here’s a new series of short articles that concentrate on one powerful tool within Prolog Pr ogramming, “Definite Clause Grammars”. These are covered in a number of tutorials on the web (refer to the information in the appendix). However I found a step by step approach, "distilled" with tests, to be the most appropriate learning path, as the topic might otherwise be a bit daunting for newcomers to comprehend. The context where I personally used the technology is for parsing application server logs and parsing programming languages such as Java. A number of probl ems arise when parsing text, such as: the ability to reuse generic structures such as lists and options to structure grammars the ease of capturing the elements recognized by the parser, and maintaining state across several rules (productions) the handling of ambiguous contexts when looking up text tokens (“lookahead”) the handling of rules with left recursion The effectiveness of ...