home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / prolog / 1693 < prev    next >
Encoding:
Internet Message Format  |  1992-09-11  |  2.1 KB

  1. Path: sparky!uunet!caen!kuhub.cc.ukans.edu!hawk!spratt
  2. Newsgroups: comp.lang.prolog
  3. Subject: Re: pretty printer
  4. Message-ID: <1992Sep11.195126.22636@hawk.cs.ukans.edu>
  5. From: spratt@hawk.cs.ukans.edu (Lindsey Spratt)
  6. Date: Fri, 11 Sep 1992 19:51:26 GMT
  7. References: <1992Sep11.091413.676@tom.rz.uni-passau.de> <4053@keele.keele.ac.uk> <1992Sep11.152125.5315@athena.cs.uga.edu>
  8. Organization: University of Kansas Computer Science Dept
  9. Lines: 32
  10.  
  11. In article <1992Sep11.152125.5315@athena.cs.uga.edu> mcovingt@athena.cs.uga.edu (Michael A. Covington) writes:
  12. >By all means let's work on it!  
  13. >
  14. >What we need is, as Paul Singleton says, a parser that parses Prolog and
  15. >also preserves white space, or at least comments.
  16. ...
  17. >First of all, does someone have the appropriate parser?  It should be a
  18. >very minor modification of an ordinary Prolog parser.
  19.  
  20. There was some discussion of this recently in this news group. It is
  21. difficult to handle comments "formally" in a parser for Prolog (or
  22. most any language), since the comments can appear anywhere whitespace
  23. can, yet have some semantic correspondence to the other syntactic
  24. element which the parser must maintain. The output formatting of
  25. comments can be quite tricky as well. Thus, I found a minor modification
  26. of an existing  grammar to be inadequate and built a DCTG grammar from
  27. scratch. This system allows one to specify the formatting approach
  28. desired for handling the various operators (another tricky area), and
  29. it (optionally) reformats the comments into "canonical" locations with
  30. appropriately indented text. The target of this formatting system
  31. was ASCII files, so only ASCII output is handled (the other kinds of
  32. output could easily be added). Another issue here  is that using a
  33. word processing system for final formatting can be a problem if the 
  34. word processing system is going to choose the places to introduce
  35. new lines, and the way to indent the "new" line. Both of these
  36. decisions should be made in a syntax-sensitive fashion which the
  37. word processing system is unlikely to be able to do (except, perhaps, for
  38. the text of comments).
  39.  
  40.  
  41.  
  42.     -lindsey
  43.