Re: standard intermediate representation for C/C++ ?

Stephen J Bevan <bevan@computer-science.manchester.ac.uk>
Fri, 15 May 1992 07:17:55 GMT

          From comp.compilers

Related articles
standard intermediate representation for C/C++ ? martin@CS.UCLA.EDU (1992-04-30)
Re: standard intermediate representation for C/C++ ? macrakis@osf.org (1992-05-05)
Re: standard intermediate representation for C/C++ ? martin@CS.UCLA.EDU (1992-05-07)
Re: standard intermediate representation for C/C++ ? sdm@cs.brown.edu (1992-05-08)
Re: standard intermediate representation for C/C++ ? root@grok19.columbiasc.NCR.COM (Dave Howell) (1992-05-11)
Re: standard intermediate representation for C/C++ ? dalamb@qucis.queensu.ca (1992-05-13)
Re: standard intermediate representation for C/C++ ? rascal@verdix.com (1992-05-14)
Re: standard intermediate representation for C/C++ ? bevan@computer-science.manchester.ac.uk (Stephen J Bevan) (1992-05-15)
Re: standard intermediate representation for C/C++ ? macrakis@osf.org (1992-05-15)
Re: standard intermediate representation for C/C++ ? mjordan@src.dec.com (1992-05-15)
Re: standard intermediate representation for C/C++ ? bevan@computer-science.manchester.ac.uk (Stephen J Bevan) (1992-05-16)
Re: standard intermediate representation for C/C++ ? kendall@centerline.com (1992-05-27)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Stephen J Bevan <bevan@computer-science.manchester.ac.uk>
Keywords: C, tools
Organization: Compilers Central
References: 92-05-065 92-05-078
Date: Fri, 15 May 1992 07:17:55 GMT

dalamb@qucis.queensu.ca (David Lamb) writes:
      From the lack of responses to the request for a 'high-level' intermediate
      representation for C/C++: Do y'all believe a "DIANA-like" representation
      would be useful if someone were to develop it? My general impression was
      that DIANA had succeeded only insofar as people thought they were forced
      to use it by the DoD [kinda depressing for us DIANA designers]


I think the problem may be that many people don't see the point of making
a compiler generate this special AST if all they are going to do is then
generate code.


However, IMHO this ignores some of the good uses that a standard AST can
be put to. Some examples, that spring to mind are :-


+ pretty printers.
    Tools like indent for C are hopless as they consistently fail on
    source that doesn't match its limited input format.


+ documentation extractors
    The common solution is to awk/sed/perl/grep sections out of the
    source, but as with the pretty printing, they are highly reliant on
    particular formats


+ tags generators
    These can be made independent of the input format.
    e.g. etags fails on some C I have because the declarations don't
    match the special format it uses to recognise functions.


+ code analysers
    e.g. somebody has written a program that trawls over the standard AST
    produced by the SRC Modula III compiler and finds which procedures
    are never called.


All the above can be written without a standard AST, but they are a
_lot_ easier to write if there is one, and don't require the user to
delve into the guts of a compiler or invent ad-hoc solutions with
crufty little languages like awk, perl ... etc.


Stephen J. Bevan bevan@cs.man.ac.uk
[Can you really do a DIANA-like thing for C? I'd think that the syntactic
messiness introduced by the preprocessor would make it awfully hard to
come up with anything that was simultaneously easier to handle than the
original source and didn't lose something significant in translation. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.