The following pages provide the Prolog code for a simple top-down,
depth-first left-to-right parser. There are two versions of the parser
- one that just recognises whether a string of words is a
well-formed instance of a given syntactic category, and
- one that also builds a parse-tree for the analysis
Both parsers use a grammar, which should be consulted first, because
the file contains the definition of ==> as on operator, which also
appears in the parser code.
The code can be saved to your filespace by saving the web page as
text and giving it a suitable name with a .pl extension.
Subsections
SJ Harlow
2000-12-14