Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!munnari.oz.au!bruce!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.prolog Subject: Re: Looking for source code for Prolog (general) Message-ID: <5525@goanna.cs.rmit.oz.au> Date: 2 May 91 03:56:45 GMT References: <1991Apr30.075951.9679@news.iastate.edu> Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 30 In article <1991Apr30.075951.9679@news.iastate.edu>, tnbf6@isuvax.iastate.edu writes: > I am currently working on a project, and am looking for examples of how to > parse prolog efficently (preferably using c or yacc code). You cannot parse Prolog using Yacc, because Prolog is not an LR(1) language. It is possible to construct a Prolog term of any desired length such that the interpretation of the first token (atom? prefix op?) cannot be determinee until the last token has been seen, which means that Prolog is not LR(k) or LL(k) for _any_ k. It is, however, fairly straightforward to parse Prolog _in_ Prolog. READ.PL is available in the DEC-10 Prolog library. > Could anyone > direct me to sites with FTP-able prolog source code, and/or books > documenting how to create prolog parsers (I have noticed that many books > on begining prolog give a rudiementry sketch of the prolog heirarchy, but > they tend not to go into full detail) Thank you in advance. There is no such word as "heirarchy". The word is "hierarchy" (from "hieros" + "arkhe"; "sacred rule" or "priest rule"). I can't for the life of me think what "the Prolog hierarchy" might be. My book, "The Craft of Prolog", provides full Prolog source code for tokenising Prolog (an update for the file TOKENS.PL in the DEC-10 library), but not READ.PL. Get a copy of the DEC-10 Prolog library from the University of Edinburgh. -- Bad things happen periodically, and they're going to happen to somebody. Why not you? -- John Allen Paulos.