Hi There! Compiler Gurus!

I have a doubt on the following productions of the C grammar.

If you look at "direct_declarator", it tries to specify a multi-dimensional 
array (or) a function.
The "*" on the declarator_suffix ensures that multi-dimensional arrays can  be 
handled.
However "*" does not serve any purpose for functions. We don't declare 
functions like "f(...)(...)(...)"
Moreover "C" does NOT allow functions to return arrays (int  unsupported()[]);

Any ideas why the grammar is so? I am planning to modify it to suit "C" style 
correctly - so I can setup the symbol table pretty easily.
Any help? Many Thanks,

"
direct_declarator
        :   (     IDENTIFIER  |  ('(' declarator ')')     )
            (declarator_suffix)*
        ;

declarator_suffix
    :   '[' constant_expression ']'
    |   '[' ']'
    |   '(' parameter_type_list ')'
    |   '(' identifier_list ')'
    |   '(' ')'
    ;
"

Best Regards,
Sarnath

________________________________
::DISCLAIMER::
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended 
for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. 
Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect the 
opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, 
distribution and / or publication of
this message without the prior written consent of the author of this e-mail is 
strictly prohibited. If you have
received this email in error please delete it and notify the sender 
immediately. Before opening any mail and
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to