Premium
An Operator Precedence Parser for Standard Prolog Text
Author(s) -
De Bosschere Koen
Publication year - 1996
Publication title -
software: practice and experience
Language(s) - English
Resource type - Journals
SCImago Journal Rank - 0.437
H-Index - 70
eISSN - 1097-024X
pISSN - 0038-0644
DOI - 10.1002/(sici)1097-024x(199607)26:7<763::aid-spe33>3.0.co;2-l
Subject(s) - prolog , computer science , programming language , parsing , parser combinator , syntax , top down parsing , grammar , operator (biology) , definite clause grammar , lr parser , natural language processing , artificial intelligence , context free grammar , phrase structure grammar , linguistics , biochemistry , chemistry , repressor , transcription factor , gene , philosophy
Prolog is a language with a dynamic grammar which is the result of embedded operator declarations. The parsing of such a language cannot be done easily by means of standard tools. Most often, an existing parsing technique for a static grammar is adapted to deal with the dynamic constructs. This paper uses the syntax definition as defined by the ISO standard for the Prolog language. It starts with a brief discussion of the standard, highlighting some aspects that are important for the parser, such as the restrictions on the use of operators as imposed by the standard in order to make the parsing deterministic. Some possible problem areas are also indicated. As output is closely related to input in Prolog, both are treated in this paper. Some parsing techniques are compared and an operator precedence parser is chosen to be modified to deal with the dynamic operator declarations. The necessary modifications are discussed and an implementation in C is presented. Performance data are collected and compared with a public domain Prolog parser written in Prolog. It is the first efficient public domain parser for Standard Prolog that actually works and deals with all the details of the syntax.