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

  1. Path: sparky!uunet!mcsun!sunic!dkuug!diku!null
  2. From: null@diku.dk (Niels Ull Jacobsen)
  3. Newsgroups: comp.lang.pascal
  4. Subject: Turbo Pascal Preprocessor wanted And yacc grammar?
  5. Keywords: TP, Preprocessor
  6. Message-ID: <1992Sep5.152127.28227@odin.diku.dk>
  7. Date: 5 Sep 92 15:21:27 GMT
  8. Sender: null@ask.diku.dk
  9. Organization: Department of Computer Science, U of Copenhagen
  10. Lines: 69
  11.  
  12. I am looking for a preprocessor for Turbo Pascal 5.0, 5.5 or 6.0.
  13.  
  14. It must resolve include files, $DEFINE, $UNDEF, $IFDEF - $ELSE -
  15. $ENDIF and $IFOPT. It would be nice if it could strip comments out as
  16. well, but keeping compiler options.
  17.  
  18. If nobody has one, I'll just have to write it myself. It shouldn't be
  19. too hard using LEX or something like that, but I would like to spare
  20. my effort.
  21.  
  22. I am also looking for a Turbo Pascal grammar in YACC style. I am writing
  23. my thesis on applications of partial evaluation on real life programs,
  24. and I'll need to be able to transform parts of a rather large Turbo Pascal
  25. program to (a subset of) C and back, as the partial evaluator transforms C
  26. source code. It would be nice to have at least a grammar to start with.
  27.  
  28. I have reviewed several of the Pascal->C translaters available, but the best
  29. of them relies on rather large libraries of C functions. Which would be rather
  30. unwieldy. An most of the others are only Pascal->C translation assistents,
  31. changing "case" to "switch", "and" to "&&" and so on.
  32. These are not good enough for my purposes.  
  33.  
  34. If anyone could give me any pointers, I'd be most grateful.
  35.  
  36. Rewriting the program in C is not an option either. The whole point of
  37. the project is to see how good AUTOMATIC optimisations can do on "real
  38. life" code. ("Real life" meaning written by enthusiastic engineers
  39. with little or no formal training in programming). Just for the fun of
  40. it, I've speeded their calculations up by 20% in a few hours of work.
  41. But not automatically.
  42.  
  43. For those interested, I'll give a VERY brief description of partial 
  44. evaluation, using this application as an example.
  45.  
  46. They are modelling water drainage in sewer systems during showers and
  47. rainstorms.  They have written a general program, which reads a sewer
  48. system description and a series of rains (e.g all rains in Copenhagen
  49. 1960-1965), and calculates where water will overflow etc.
  50.  
  51. Unfortunately, the program is quite slow. Now, if they just wanted to
  52. simulate the sewers of Copenhagen, they could write a much faster
  53. program to do this. But then they would have to write a new program 
  54. when they wanted to simulate another sewer system. Or at least rewrite
  55. the old, introducing new errors etc.
  56.  
  57. The idea is to automatically generate a specialised (fast) program
  58. from the general (slow) program and the sewer description. Much like
  59. a very good compiler would do, if the sewer system description had 
  60. been given as "const" data at the start of the general program. This
  61. involves resolving all tests solely dependant on the sewer system 
  62. characteristics, transforming the linked list of sewer installations
  63. to global variables, unfolding loops etc.
  64.  
  65. Well, I hope to hear from you. Please post, but I would like a copy
  66. in email, as I may miss your reply in the mass of messages.
  67.  
  68. Thanks!
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76. -- 
  77.    Niels Ull Jacobsen, Dep. of C.S., U of Copenhagen (null@diku.dk)
  78.    Adaz sighed.  "So how long will this journey take?" 
  79.    "A month?" Sutekh shrugged.  "Depends on when the horses die." 
  80.      -- from "Adaz & Sutekh" by Jeff Stehman
  81.