Path: utzoo!mnetor!uunet!husc6!think!ames!pasteur!ucbvax!decwrl!hplabs!hpda!hp-sde!hpfcdc!hpldola!winter From: winter@hpldola.HP.COM (Kirt Winter) Newsgroups: comp.software-eng Subject: Re: Style rules for C shops Message-ID: <1420006@hpldola.HP.COM> Date: 5 May 88 15:04:12 GMT References: <528@vsi.UUCP> Organization: HP Elec. Design Div. -ColoSpgs Lines: 60 In my just completed MS work at Oregon State, I looked into the possibility of doing a truly flexible prettyprinter. I'll summarize some of the things I learned. In particular, I chose to look at syntactic style (where should this keyword/ construct be placed relative to anoter). Once you decide that flexibility is necessary, the next question is how one goes about specifying his/her style to the prettyprinter. In the prototype I constructed (works with standard Pascal and Turbo 3.0 dialect) you give it a "style sample". This can either be done by modifying a sample program that I provided (or giving a different sample program that you have already written), giving that sample to the prettyprinter, and use a command-line option that tells the prettyprinter to "learn". The prototype (while not bug free) does a nice job of capturing the vast majority of syntactic styles given to it. It could easily be modified to capture more (at least by me, it's a little "hackish" right now). I do plan (sometime, I just started a new job) to do a C version sometime in the future. I guess if there is sufficient interest/market, I might get around to it sooner. I have also been told of a flexible prettyprinter for the Logitech Modula II compiler (I think it is now included with it). What it doesn't do is do any modification of keywords, identifiers, etc. If this is a big requirement, it is easy to add, it just didn't fall in line with my MS work, and I had a job waiting so... We've thought about several possible uses for it, and I'll just list a few of them here: - Would allow for "company standards" as well as individual taste. (you could change company style to your style to someone else's and back) - Use the produced "style files" (in the learn phase) to measure deviation from standards. - In the academic world, use "style files" to identify authorship. (studies have shown that current metrics, including Barry & Meekings style measure, aren't useful for this task) - Use it as a research tool to decide what (if anything) in syntactic style makes a style "good" for comprehension, or how one's style evolves over time (and perhaps how much that correlates with a person's proficiency with a particular language). If anyone is interested, I can provide you with some more details. If I get a lot of interest, I'll post a longer discussion to the net. Kirt ------------------------------------------------------------------------------- Kirt Alan Winter winter@hpldola.hp.com Hewlett Packard - EDD (719) 590-5974 Colorado Springs, Colorado ------------------------------------------------------------------------------- These ideas represent my opinions alone, not HP's (at least for now...). -------------------------------------------------------------------------------