🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #711

Re: pretty printer

#711
From: Lindsey Spratt
Date: Fri, 11 Sep 1992 19:51
32 lines
2153 bytes
In article <1992Sep11.152125.5315@athena.cs.uga.edu> mcovingt@athena.cs.uga.edu (Michael A. Covington) writes:
>By all means let's work on it!  
>
>What we need is, as Paul Singleton says, a parser that parses Prolog and
>also preserves white space, or at least comments.
...
>First of all, does someone have the appropriate parser?  It should be a
>very minor modification of an ordinary Prolog parser.

There was some discussion of this recently in this news group. It is
difficult to handle comments "formally" in a parser for Prolog (or
most any language), since the comments can appear anywhere whitespace
can, yet have some semantic correspondence to the other syntactic
element which the parser must maintain. The output formatting of
comments can be quite tricky as well. Thus, I found a minor modification
of an existing  grammar to be inadequate and built a DCTG grammar from
scratch. This system allows one to specify the formatting approach
desired for handling the various operators (another tricky area), and
it (optionally) reformats the comments into "canonical" locations with
appropriately indented text. The target of this formatting system
was ASCII files, so only ASCII output is handled (the other kinds of
output could easily be added). Another issue here  is that using a
word processing system for final formatting can be a problem if the 
word processing system is going to choose the places to introduce
new lines, and the way to indent the "new" line. Both of these
decisions should be made in a syntax-sensitive fashion which the
word processing system is unlikely to be able to do (except, perhaps, for
the text of comments).



	-lindsey
Technical Details
Message-ID: <1992Sep11.195126.22636@hawk.cs.ukans.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!caen!kuhub.cc.ukans.edu!hawk!spratt
References: <1992Sep11.091413.676@tom.rz.uni-passau.de> <4053@keele.keele.ac.uk> <1992Sep11.152125.5315@athena.cs.uga.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!caen!kuhub.cc.ukans.edu!hawk!spratt
Newsgroups: comp.lang.prolog
Subject: Re: pretty printer
Message-ID: <1992Sep11.195126.22636@hawk.cs.ukans.edu>
From: spratt@hawk.cs.ukans.edu (Lindsey Spratt)
Date: Fri, 11 Sep 1992 19:51:26 GMT
References: <1992Sep11.091413.676@tom.rz.uni-passau.de> <4053@keele.keele.ac.uk> <1992Sep11.152125.5315@athena.cs.uga.edu>
Organization: University of Kansas Computer Science Dept
Lines: 32