Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] query regarding parse actions

We're doing the same thing in our LPG grammar that we're playing with.
Every action consists of a single API call, e.g.
consumeDeclarationSpecifier(), which then takes care of all the actual
work.  Keeps the grammar clean, and like you say, subclassing becomes much
easier.

===========================

Chris Recoskie
Team Lead, IBM CDT Team
IBM Toronto
http://www.eclipse.org/cdt



                                                                           
  From:   Craig Rasmussen <crasmussen@xxxxxxxx>                            
                                                                           
  To:     "CDT General developers list." <cdt-dev@xxxxxxxxxxx>             
                                                                           
  Date:   01/12/2006 05:52 PM                                              
                                                                           
  Subject Re: [cdt-dev] query regarding parse actions                      
  :                                                                        
                                                                           





On Nov 30, 2006, at 6:13 AM, Chris Recoskie wrote:

> Currently this is not easy to do.  You would have to modify the
> implementation of the parser itself, or subclass it (which wouldn't be
> terribly pretty either)  in order to do this as things stand now.
>
> We are experimenting with using generated parsers that are
> generated from a
> grammar.  This would make what you want to do more easily
> possible.  That
> work should start appearing in CDT 4.0.
>

With the Fortran 2003 parser we at working on, we have a similar
requirement.  We need to build the AST generation environment so that
we can hook it up to different AST generators.  What we are thinking
of doing is having every action call to an API.  This would allow for
substitution and subclassing.

Cheers,
Craig


> ===========================
>
> Chris Recoskie
> Team Lead, IBM CDT Team
> IBM Toronto
> http://www.eclipse.org/cdt
>
>
>
>
>   From:   "chinmay narayan" <chinu.pandey@xxxxxxxxx>
>
>   To:     cdt-dev@xxxxxxxxxxx
>
>   Date:   30/11/2006 08:06 AM
>
>   Subject [cdt-dev] query regarding parse actions
>   :
>
>
>
>
>
> Hi all,
> is it possible to extend the actions that are done while parsing the
> language through CDT parser. What i mean is, Parser.parse function
> continuosly reads the token and build the AST correspondingly.. i want
> to add some other work , is it possible to extend the actions taken by
> the Parser? is it possible to do without changing the parser class as
> such..? or do i need to implement some base class?
>
> plz guid me..
> regards
> chinmay
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev




Back to the top