Function declaration

Philippe Sigaud philippe.sigaud at gmail.com
Wed Dec 25 13:23:12 PST 2013


On Wed, Dec 25, 2013 at 4:57 PM,  <"Casper Færgemand\"
<shorttail at hotmail.com>"@puremagic.com> wrote:
> From http://dlang.org/declaration.html#Parameter
>
> Parameter:
>     InOutopt BasicType Declarator
>     InOutopt BasicType Declarator ...
>     InOutopt BasicType Declarator = DefaultInitializerExpression
>     InOutopt Type
>     InOutopt Type ...
>
> How do I add a declarator to a parameter like "char * format"? I altered the
> language specification to add a "InOutopt Type Declarator", but is there
> another way? The specification overall is really good, but I've found a few
> missing things elsewhere, and I'm wondering if it really is missing or I'm
> missing the point. :P I can't see any way to add a parameter name to
> something of type Type.

I'll consider that as a D grammar question, and not a Pegged-specific
question, since Pegged just uses a copy of the D site grammar :-)

As to this specific question, my answer is halas: I don't know. I find
parts of the D grammar a bit complicated for my taste (with 200
different rules, it's the most complicated programming language
grammar I know of). I'll let some grammar specialist answers there
(there are a few around these parts). I know some people have a
cleaned-up, alternate grammar, but I can't remember the link.



More information about the Digitalmars-d-learn mailing list