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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!leah!albanycs!crdgw1!uunet!mcvax!unido!pfm!nadia!benno From: benno@nadia.UUCP (Benno Riede) Newsgroups: comp.lang.ada Subject: parser Message-ID: <475@nadia.UUCP> Date: 19 May 89 00:35:10 GMT Reply-To: benno@nadia.UUCP (Benno Riede) Organization: Stuttgart Net System, FRG List-Id: Quote from the ALRM 1.3(5): "No language can avoid the problem of efficiency. Languages that require over-elaborate compilers, or that lead to inefficient use of storage or execution time, force these inefficiencies on all machines and on all programs. Every construct of the language was examined in the light of PRESENT IMPLEMENTATION TECHNIQUES. Any proposed construct whose implementation was unclear or that required excessive machine resources was rejected." Can someone tell me what "implementation techniques" to use for an Ada parser and for overload resolution and where they are described? An LR parser (the best technique I know) cannot successfully determine a syntax tree of the following program (or can it?): procedure QUESTION is type ARRAY_T is array (BOOLEAN) of INTEGER; A: INTEGER; function PROBLEM return ARRAY_T is ... end; function PROBLEM (A: INTEGER) return INTEGER is ... end; begin A := PROBLEM (TRUE); -- an indexed component A := PROBLEM (A); -- a function call with parameter end QUESTION; How does an LR parser know if a function name followed by a left parenthesis is a function call without parameters and should be reduced to the prefix of an indexed component or if it is part of a function call with parameters? Or when is this determined? If not by the parser, why this syntax notation in the ALRM?: indexed_component ::= prefix (expression {, expression}) prefix ::= name | function_call function_call ::= function_name [actual_parameter_part] actual_parameter_part ::= (parameter_association {, parameter_association}) I can think about very complicated, compile time waisting algorithms that recognize these constructs (, for which the syntax notation used in the ALRM were senseless). But having in mind what they write about performance, I think "There must be something else, that I do not know (yet).". As I suppose that the AJPO is highly interested in Ada compilers being written, it would make sense if there was some publication by them, where the language is described in a more formal form than in the ALRM, say, where they propose how to make an Ada compiler or tell "how we made our's". Does it exist? -- Schoenen Tag noch! Benno Riede; Olgastr. 103; D-7000 Stuttgart 1; +49-711-6408917