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

  1. Path: sparky!uunet!mcsun!uknet!comlab.ox.ac.uk!oxuniv!popx
  2. From: popx@vax.oxford.ac.uk
  3. Newsgroups: comp.lang.prolog
  4. Subject: Re: pretty printer
  5. Message-ID: <1992Sep11.144020.8813@vax.oxford.ac.uk>
  6. Date: 11 Sep 92 13:40:19 GMT
  7. References: <1992Sep11.091413.676@tom.rz.uni-passau.de>
  8. Organization: Oxford University VAX 6620
  9. Lines: 42
  10.  
  11. In article <1992Sep11.091413.676@tom.rz.uni-passau.de>, baier@forwiss.uni-passau.de (Joern Baier) writes:
  12. > Hi!
  13. > As the subject says it I'm looking for a pretty printer.
  14. > It should read a source code and write it down in a nicer format.
  15. > It should also be able to deal with comments and keep the vaiable
  16. > names. I have been looking for it in the libraries but I think there is
  17. > nothing appropriate.
  18. > Thanx in advance,
  19. >             Joern
  20. > -- 
  21. > Joern Baier     (baier@forwiss.uni-passau.de) 
  22. >
  23. I don't have a complete pretty-printer. However, the code that comes 
  24. with my "Logic Programming Tutor" includes some of what you need to 
  25. build one. There's a set of predicates (SDO.PL and SDO_OUTPUT.PL) which
  26. read the grammar of a language in a notation that's like DCGs augmented
  27. with formatting commands and generate Prolog predicates from it. Portability
  28. note: you'll need to be able to 'write' into lists or other structures.
  29.  
  30. There's also a tokeniser and parser, built from the Richard O'Keefe one
  31. that comes with the Dec-10 library. This can read variable names. It ignores
  32. comments, but you could make it capture them and return them hooked
  33. onto the term in some way. I'm not sure what the best way to represent
  34. a term augmented in this way would be.
  35.  
  36. You can FTP the code from packages/prolog-pd-software/tutor.tar.Z at
  37. src.doc.ic.ac.uk . It's a compressed TAR file, so fetch it in binary
  38. mode, and decompress then untar before using. 
  39.  
  40. If you do build a pretty-printer from these predicates, please send me
  41. a copy of it.
  42.  
  43.  
  44. General note: the library contains a lot of other code. See README in the
  45. aforenamed directory for a short list, CATALOGUE for a long one. 
  46. I would like more contributions: the number I've been offered so far is
  47. very low compared with the amount of Prolog code that exists.
  48.  
  49.  
  50. Jocelyn Paine
  51.