Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Attempting to make a Cosmic C Language Extension

Hi Sebastian,

That was exactly the problem. Thanks! Now my extension is working. I may be running into the limits of extending GCCLanguage, though. To recognize (instead of just skip) @<foo> keywords, I'm having to re-implement (actually just copy and paste the code) the entire GCC parser.

So now I'm looking at using the approach that C99 and UPC take (http://recoskie.blogspot.com/2007/05/language-extensibility-in-cdt-40.html) using the LPG  parser.

Thanks,

Peter



From:        Sebastian Wagner <se.wagner@xxxxxx>
To:        CDT General developers list. <cdt-dev@xxxxxxxxxxx>,
Date:        03/31/2013 04:27 AM
Subject:        Re: [cdt-dev] Attempting to make a Cosmic C Language Extension
Sent by:        cdt-dev-bounces@xxxxxxxxxxx




Hello Peter,

I did something similar for another compiler:
- used language extension point to create new langage extending GCCLanguage
- the new language refers to an own ScannerExtensionConfiguration and ParserExtensionConfiguration
- added the language mapping to the project configuration

However, I think that there may be a bug in your CosmicCLanguage Class. I think you must implement the method getDefault() to return an instance of your language. I did it like this:

   private static MyLanguage DEFAULT = new MyLanguage();
   
   public static MyLanguage getDefault() {
       return DEFAULT;
   }


In your case it alway uses the getDefault of the super class and will therefore use GCCLanguage and it's configuration.

regards, Sebastian


To: cdt-dev@xxxxxxxxxxx
Date: Fri, 22 Mar 2013 07:19:34 -0800
From: peter.watkins@xxxxxxxxxxxxx
Subject: Re: [cdt-dev] Attempting to make a Cosmic C Language Extension

So part of my problem was that CosmicCScannerExtensionConfiguration was a singleton but I wasn't calling it as one (nor had I quite coded it as one). The end result is still the same (@far isn't recognized).


By the way, let me know if I should be posting this question in a different list.




From:        
"Peter Watkins" <peter.watkins@xxxxxxxxxxxxx>
To:        
cdt-dev@xxxxxxxxxxx,
Date:        
03/21/2013 03:15 PM
Subject:        
[cdt-dev] Attempting to make a Cosmic C Language Extension
Sent by:        
cdt-dev-bounces@xxxxxxxxxxx




After reading
http://www.eclipse.org/forums/index.php/mv/msg/162043/512293/#msg_512293, I'm trying to make a new language extension for the Cosmic dialect of C. Mostly the problem is "@" keywords such as @far. I've looked at bug #237028, and POPCPPScannerExtensionConfiguration.java. I also went off Mike Kucera's message to this group, "Re: [cdt-dev] How to extend the C99 / GCC LR Parser." on 11-Jul-2011 in which he suggests using an ILanguage extension point and providing my own configuration that implements IScannerExtensionConfiguration and defines supportAtSignInIdentifiers().

I've made the language plugin consisting of Activator.java, CosmicCLanguage.Java, and CosmicCScannerExstensionConfiguration.java. I can choose my new language under Language Mappings in the CDT. However the parser still trips up over @far. Here's my parser log (I've deleted some lines to make it smaller):


_______________________________________________ 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