Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [cdt-dev] c99 parser build

I think the intention for multi-language support was to allow language
implementers to extend the IAST, IBinding, IType, etc. interfaces to add in
their own concepts, like shared. At least that's what I had in mind in the
early stages. We kind-a do that between C and C++. UPC should probably do
the same. Fortran and C# need to do that in a big way.

Since this is the first externally defined language to try it, I'm not sure
we have everything in place. We may need to tweak the model for Ganymede to
make it work.

Doug Schaefer, QNX Software Systems
Eclipse CDT Project Lead, http://cdtdoug.blogspot.com


> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On
> Behalf Of Mike Kucera
> Sent: Wednesday, July 11, 2007 4:01 PM
> To: CDT General developers list.
> Subject: RE: [cdt-dev] c99 parser build
> 
> Sigh, I can't seem to find an easy way of displaying new type qualifiers
> in
> the outline view. The strings that are displayed are pretty much
> hard-coded. The labels in the outline view come from the model builder,
> from ASTStringUtil.appendDeclSpecifierString(), which is both internal and
> static, so you can't access it and you can't override it. This method is
> called through CModelBuilder2.createVariable(). ILanguage has the method
> createModelBuilder() which allows a language to replace the entire model
> builder. Unfortunately the obvious approach of subclassing CModelBuilder2
> and overriding createVariable() won't work because its both internal and
> private.
> 
> So our options are:
> 1) Write your own model builder and return it from ILanguage. Not fun.
> 2) Patch the model builder.
> 3) Use AspectJ, create a pointcut that intercepts the call to
> ASTStringUtil.appendDeclSpecifierString(), and weave in your own
> implementation... just joking!
> 
> Number 2 seems like the best option. I created a patch that makes a
> non-breaking API change to the model builder code to allow the labels to
> be
> customized. The patch is attached to bug #196212
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=196212). Could a core model
> expert please review it, thanks.
> 
> 
> Mike Kucera
> Software Developer
> IBM CDT Team, Toronto
> mkucera@xxxxxxxxxx
> 
> 
> 
> 
> 
>              Mike
>              Kucera/Toronto/IB
>              M@IBMCA                                                    To
>              Sent by:                  "CDT General developers list."
>              cdt-dev-bounces@e         <cdt-dev@xxxxxxxxxxx>
>              clipse.org                                                 cc
>                                        "CDT General developers list."
>                                        <cdt-dev@xxxxxxxxxxx>,
>              07/11/2007 11:08          cdt-dev-bounces@xxxxxxxxxxx
>              AM                                                    Subject
>                                        RE: [cdt-dev] c99 parser build
> 
>              Please respond to
>                "CDT General
>              developers list."
>              <cdt-dev@eclipse.
>                    org>
> 
> 
> 
> 
> 
> 
> Looks like you found something I need to fix. I'll take a look.
> 
> Mike Kucera
> Software Developer
> IBM CDT Team, Toronto
> mkucera@xxxxxxxxxx
> 
> 
> 
> 
> 
>              "Michael
>              Wrighton"
>              <mikew@clearspeed                                          To
>              .com>                     "CDT General developers list."
>              Sent by:                  <cdt-dev@xxxxxxxxxxx>
>              cdt-dev-bounces@e                                          cc
>              clipse.org                <cdt-dev-bounces@xxxxxxxxxxx>
>                                                                    Subject
>                                        RE: [cdt-dev] c99 parser build
>              07/11/2007 06:16
>              AM
> 
> 
>              Please respond to
>                "CDT General
>              developers list."
>              <cdt-dev@eclipse.
>                    org>
> 
> 
> 
> 
> 
> 
> This is all up and running and looks good but one thing I've noticed
> when using the UPC plugin is that the 'shared' qualifier is not shown in
> the outline view, whereas the other built-in qualifiers such as const
> and volatile are. Is this outside the scope of the parser?
> 
> 
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Michael Wrighton
> Sent: 11 July 2007 09:58
> To: CDT General developers list.
> Cc: cdt-dev-bounces@xxxxxxxxxxx
> Subject: RE: [cdt-dev] c99 parser build
> 
> Ok sorted now, yeah I had the whole c99 directory checked out
> originally.
> 
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Mike Kucera
> Sent: 10 July 2007 18:30
> To: CDT General developers list.
> Cc: CDT General developers list.; cdt-dev-bounces@xxxxxxxxxxx
> Subject: RE: [cdt-dev] c99 parser build
> 
> Um, I'm not exactly sure, maybe Chris can answer this better. I think if
> you have the source for CDT and the C99 stuff then you shouldn't need to
> install it from the update site.
> 
> The problem might be that you haven't checked out the C99 plugins
> properly.
> You have to go to the org.eclipse.cdt/C99 directory and checkout each
> individual plugin from there, so that then show up as top level projects
> in
> your workspace. Otherwise if you just checkout org.eclipse.cdt then it
> won't work (I think).
> 
> 
> Mike Kucera
> Software Developer
> IBM CDT Team, Toronto
> mkucera@xxxxxxxxxx
> 
> 
> 
> 
>              "Michael
> 
>              Wrighton"
> 
>              <mikew@clearspeed
> To
>              .com>                     "CDT General developers list."
> 
>              Sent by:                  <cdt-dev@xxxxxxxxxxx>
> 
>              cdt-dev-bounces@e
> cc
>              clipse.org
> 
> 
> Subject
>                                        RE: [cdt-dev] c99 parser build
> 
>              07/10/2007 12:58
> 
>              PM
> 
> 
> 
> 
> 
>              Please respond to
> 
>                "CDT General
> 
>              developers list."
> 
>              <cdt-dev@eclipse.
> 
>                    org>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Ok cool, that shouldn't be a problem. Just a quick question with regards
> to running - do I need to install c99, upc etc properly from the update
> site even though I have the source? I ask because I can't see c99 in the
> language mappings dialog when I run?
> 
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Mike Kucera
> Sent: 10 July 2007 17:49
> To: CDT General developers list.
> Subject: RE: [cdt-dev] c99 parser build
> 
> Yes, the LPG based parser is designed to be extensible so that its easy
> to
> do exactly the types of things that you said you need to do.
> 
> The only issue is that the LPG based stuff should be considered
> experimental right now, there is going to be quite a bit of API churn as
> I
> decouple the preprocessor and add support for C++. If you want to keep
> synchronized to HEAD you are going to have to keep up with my changes.
> 
> I do appreciate any feedback you would have on how the experience of
> extending the parser could be made better/easier. I'll try to answer any
> questions you have.
> 
> These docs here are meant to be an intro to parsing in CDT:
> http://wiki.eclipse.org/CDT/designs. Also take a look at the UPC plugin
> which is built as an extension to the C99 plugin.
> 
> Mike Kucera
> Software Developer
> IBM CDT Team, Toronto
> mkucera@xxxxxxxxxx
> 
> 
> 
> 
> 
>              "Michael
> 
>              Wrighton"
> 
>              <mikew@clearspeed
> To
>              .com>                     "CDT General developers list."
> 
>              Sent by:                  <cdt-dev@xxxxxxxxxxx>
> 
>              cdt-dev-bounces@e
> cc
>              clipse.org
> 
> 
> Subject
>                                        RE: [cdt-dev] c99 parser build
> 
>              07/10/2007 12:17
> 
>              PM
> 
> 
> 
> 
> 
>              Please respond to
> 
>                "CDT General
> 
>              developers list."
> 
>              <cdt-dev@eclipse.
> 
>                    org>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Thanks. Actually I'm implementing a CDT plugin that supports C but just
> with a couple of additional type qualifiers, that's all. But I want
> these to be properly displayed in the outline view etc so from what I've
> read, using this new LPG mechanism seems like the cleanest way of doing
> it.
> 
> I had a go using the old method but it looked as though I would have to
> extend ASTStringUtil, CmodelBuilder2, TranslationUnit and god knows what
> else above that, just to get the new qualifier strings in the AST nodes.
> 
> -----Original Message-----
> From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
> On Behalf Of Mike Kucera
> Sent: 10 July 2007 17:07
> To: CDT General developers list.
> Subject: Re: [cdt-dev] c99 parser build
> 
> The code for the C99 parser is in CVS under org.eclipse.cdt/C99.
> 
> There are three grammar files in the package
> org.eclipse.cdt.internal.core.dom.parser.c99,
> 1) C99Lexer.g, the grammar file that defines how the character stream
> should be lexed into tokens
> 2) C99Parser.g, specifies the C99 grammar
> 3) C99ExprEvaluator.g, the preprocessor expression evaluator is itself
> implemented as an LPG parser, you can probably ignore this if you are
> just
> interested in the grammar of C99.
> 
> Keep in mind that CDT is an IDE and not a compiler, so our parsers work
> differently from what you would expect in a front end for a compiler or
> interpreter. In particular we don't keep track of any semantic info
> during
> the parse and we don't do any type-checking.
> 
> Are you implementing an extension to the C spec? or are you implementing
> your own language and just using C for inspiration? I'm asking because
> if
> you are designing a new language from scratch I would heavily advise
> against using C as your source for inspiration (and don't even think
> about
> using the C preprocessor).
> 
> 
> Mike Kucera
> Software Developer
> IBM CDT Team, Toronto
> mkucera@xxxxxxxxxx
> 
> 
> 
> 
> 
> 
>              "Michael
> 
>              Wrighton"
> 
>              <mikew@clearspeed
> To
>              .com>                     "CDT General developers list."
> 
>              Sent by:                  <cdt-dev@xxxxxxxxxxx>
> 
>              cdt-dev-bounces@e
> cc
>              clipse.org
> 
> 
> Subject
>                                        [cdt-dev] c99 parser build
> 
>              07/10/2007 11:39
> 
>              AM
> 
> 
> 
> 
> 
>              Please respond to
> 
>                "CDT General
> 
>              developers list."
> 
>              <cdt-dev@eclipse.
> 
>                    org>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> Hi,
> 
> Could someone tell me how I can build/enable the c99 parser? Really I?m
> interested in looking at the source and the c99 grammar file so I can
> get
> started on my own C-based language. I?ve got the latest CDT checked out
> but
> all I can see is a rather small org.eclipse.cdt.releng/c99/ directory?
> 
> Thanks
> Mike Wrighton_______________________________________________
> 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
> 
> 
> _______________________________________________
> 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
> _______________________________________________
> 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
> 
> 
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top