From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=BAYES_00,FROM_NUMERIC_TLD, INVALID_MSGID,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ea40456edaea3d23 X-Google-Attributes: gid103376,public From: steved@pacifier.com@199.2.117.163 (Steve Doiel) Subject: Re: Pascal to Ada translator/ aflex,ayacc GNAT ports Date: 1996/11/28 Message-ID: <57j17b$6pt@news.pacifier.com>#1/1 X-Deja-AN: 201166455 references: <57htn2$jm8@cnn.Princeton.EDU> <57i8af$p8m@felix.seas.gwu.edu> organization: Pacifier BBS, Vancouver, Wa. ((360) 693-0325) reply-to: steved@pacifier.com (Steve Doiel) newsgroups: comp.lang.ada Date: 1996-11-28T00:00:00+00:00 List-Id: In Michael Feldman writes: >In article <57htn2$jm8@cnn.Princeton.EDU>, >Martin C. Carlisle wrote: >>I have just completed a preliminary version of a pascal to ada >>translator (some features like "with" aren't handled) using aflex >>and ayacc. It is publicly available at: > >This looks like it has a lot of real potential as a valuable tool. >What _does_ it do with a Pascal "with"? Maybe it should mark such >lines in an obvious way for hand-tweaking? > >Expanding a Pascal "with" into full field-selection looks intuitively >similar to the "use" expansion some Ada tools can do. > My $0.02 worth: In working with a Pascal to Ada translator from Wiljan Derks. I believe I have learned a few things about what makes a for a good translation. One of which is to make the translated code look very much like the original code. Wiljan originally had the code explicitly qualify all references to fields that were brought into scope using the "with". I found the generated code to be hard to read, so I modified the generation to generate the following translation: with complex.expression[ witharrayindex ] do begin field1 := value; end; .. maps to ... declare w_0 : aRecordType renames complex.expression[ witharrayindex ]; begin w_0.field1 := value; end; Which makes the translated code look very much like the original IMHO. > >In any event, good luck with this! Keep up the good work! > >Mike Feldman