[comp.lang.ada] parser

benno@nadia.UUCP (Benno Riede) (05/19/89)

 
       
         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