Re: [RFA] Add language-dependent post-parser

Daniel Jacobowitz
2004-04-09T22:40:23Z

On Wed, Apr 07, 2004 at 05:32:35AM -0400, Paul Hilfinger wrote:
>
> Here is a second version of the post-parser patch I submitted before.
> The Ada module will use the post-parser to do static overloaded name
> resolution at translation time. The patch gives the current languages
> a default nop post-parser.
>
> I think I have addresses Daniel's comments. In this revision, I have
> simplified the interface to the post-parser and to
> parse_expression_in_context so that instead of an expected type, they
> just take a flag indicating whether the client expects a value (as
> opposed to simply evaluating for side effects).
>
> At the moment, nothing uses this flag in the public sources. In ACT's
> code (in a change I will propose later), we have modified the 'call'
> command to use this flag, and our post-parser uses the void/non-void
> context distinction to disambiguate between overloaded procedures
> (void-returning functions) and value-returning functions. This sort
> of limited, context-dependent disambiguation is not useful in C or
> C++, but is useful in Ada. We do not implement Ada's full
> context-dependent type resolution; for the debugger, that simply turns
> out to be overkill.
>
> This better?

Thanks; this is OK.

> 2004-03-04 Paul N. Hilfinger <Hilfinger@gnat.com>
>
> * language.h (language_defn): Add new la_post_parser field.
> * parser-defs.h (null_post_parser): New declaration (default for
> la_post_parser).
>
> * parse.c (parse_exp_1): Move code to parse_exp_in_context and
> insert call to that function.
> (parse_exp_in_context): New function, including code formerly in
> parse_exp_1. Calls language-dependent post-parser after
> prefixification.
> (parse_expression_in_context): New exported function.
> (null_post_parser): New definition.
> * expression.h (parse_expression_in_context): Add declaration.
>
> * p-lang.c (pascal_language_defn): Add trivial post-parser.
> * c-lang.c (c_language_defn): Ditto.
> (cplus_language_defn): Ditto.
> (asm_language_defn): Ditto.
> (minimal_language_defn): Ditto.
> * f-lang.c (f_language_defn): Ditto.
> * jv-lang.c (java_language_defn): Ditto.
> * language.c (unknown_language_defn): Ditto.
> (auto_language_defn): Ditto.
> (local_language_defn): Ditto.
> * m2-lang.c (m2_language_defn): Ditto.
> * scm-lang.c (scm_language_defn): Ditto.
> * obj-lang.c (objc_language_defn): Ditto.

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer