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