Georg Bauhaus <[email protected]> writes:

> Some progress, and some observations.
>
> 1. Progress at the cost of introducing tolerance of "expression
> subprograms", not just expression functions; doing that seems a way
> to avoid new conflicts. 
>
> Is it tolerable if Ada mode allows procedure expressions?

In general, it's ok to allow extensions of the Ada grammar in the Ada
mode parser (I should state that explicitly somewhere in ada-grammar.wy
and ada-mode.texi; I thought it was in the former).

The purpose of the Ada mode parser is to support writing code via
indentation and navigation. It is explicitly _not_ the purpose to
enforce the language rules; the compiler does that already.

You are doing it to eliminate conflicts; there are some other instances
of that in ada-grammar.wy.

Another reason to extend the grammar is to allow parsing partially
written statements; allowing empty items in sequences of statements is a
good example.

On the other hand, transforming functions into procedures sounds like it
might be going too far; it could cause confusion in the
navigation/indentation functions. I'd like to see the code; I might have
an idea on how to avoid this.

> 2. It turns out that the Wisi grammar needs to take LRM 4.5.7 7/3
> into account. The latter permits dropping parens around the new
> expression forms. If they are not found around an if_expression,
> for example, then parsing fails:
>
>   Y : Boolean := Boolean'(if True then False);
> vs.
>   Y : Boolean := Boolean'((if True then False));  -- o.K.
>
> Since the Ada permission also applies to a few other places in the
> grammar, e.g. actual_parameter_part, it may be better to rearrange the
> productions a little, I think. This would, however, take some more time
> and some more considerations. 

Argh, good catch. I'll leave that for 5.1; the code accepted by 5.0 is
legal, so I'll just say "add the optional parens" is a reasonable
workaround. 

-- 
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to