[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [cdt-dev] adding a new language to the CDT
|
A good way to find out what is going wrong is
to check whether PDOMWriter.addSymbols(..) is
called. That is where the indexer extracts the information from the AST. If
it is not called try to figure out the difference to a regular c-file. If it is
called you are almost there.
Markus.
Hi Markus,
thank you for your answer.
You're
right, first I want minimal support, so I use the
CASTTranslationUnit.
I've make sure that the
language is registered at the CDT. It extends AbstractLanguage and the
language must be known by the CDT, because it calls it's getASTTranslatuinUnit
function.
I've implemented your proposal
returning the ILinkage.C_LINKAGE_ID but after that, the situation is the
same.
Maybe you have an other idea what I'm
doing wrong.
Kind regards
Michael Rosenfelder
cdt-dev-request@xxxxxxxxxxx Sent by: cdt-dev-bounces@xxxxxxxxxxx
28.10.2008 18:16
Please respond
to cdt-dev@xxxxxxxxxxx |
|
To
| cdt-dev@xxxxxxxxxxx
|
cc
|
|
Subject
| cdt-dev Digest, Vol 44, Issue
52 |
|
Send cdt-dev mailing list submissions to
cdt-dev@xxxxxxxxxxx
To subscribe or
unsubscribe via the World Wide Web, visit
https://dev.eclipse.org/mailman/listinfo/cdt-dev
or, via email, send a
message with subject or body 'help' to
cdt-dev-request@xxxxxxxxxxx
You can reach the
person managing the list at
cdt-dev-owner@xxxxxxxxxxx
When replying, please edit your
Subject line so it is more specific
than "Re: Contents of cdt-dev
digest..."
Today's Topics:
1. RE: adding a new
language to the CDT (Schorn, Markus)
2. Re: adding a new language to
the CDT (Tom Ball)
3. RE: adding a new language to the CDT
(Hilliard,
Bill)
----------------------------------------------------------------------
Message:
1
Date: Tue, 28 Oct 2008 17:08:45 +0100
From: "Schorn, Markus"
<Markus.Schorn@xxxxxxxxxxxxx>
Subject: RE: [cdt-dev] adding a new
language to the CDT
To: "CDT General developers list."
<cdt-dev@xxxxxxxxxxx>
Message-ID:
<460801A4097E3D4CA04CC64EE64858480847F656@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Content-Type:
text/plain; charset="us-ascii"
Hi Michael,
just to make it clear,
what you are trying to do cannot be done via
public API and is thus not
supported by CDT.
When using CDT to add PL8 support you first have to
make the decision
whether you are looking at language extension of c or
c++. Only, then
you can safely reuse the existing implementation of IAST...
interfaces.
In case your language is different, you should be creating your
own AST
that represents PL8. I guess you just want minimal support for PL8,
so
you probably can get away with faking a CASTTranslationUnit.
If
you do have a parser that creates a reasonable IASTTranslationUnit,
you
have to make sure that the language is registered with CDT (there is
an
extension point for that). Also the langauge needs to return the
correct
linkage-id, in
order to be considered for indexing. In your case you want
the stuff to
be added to the c-linkage, so you should
return
ILinkage.C_LINKAGE_ID.
You might have to use a debugger to
figure out whether your parser get's
called and whether stuff is added
to
the
index.
Markus.
________________________________
From:
cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf
Of Michael Rosenfelder
Sent: Tuesday, October 28, 2008 2:15 PM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] adding a new language to
the CDT
Importance:
Low
Hi,
I'm working on an Eclipse Plug-In to support a
procedural
programming language called PL8, a PL/I variant for systems
programming.
We have PL8 and C source files in one source tree (project).
Our
compiler builds all files to object files and then they are
linked
together to one binary. It is possible to call a C-function from
a
PL8-function and vice versa. So our idea was to use the CDT and
treat
the source tree as a C/C++ project. The C/C++ files will be handled
by
CDT and the PL8 files are handled by a PL8 editor (Syntax
highlighting,
outline view). We also want to use the code navigation
feature in the
PL8 context. Therefore our idea was to add some informations
like
function definitions in the C-index. We created a Java class
PL8Language
implementing the ILanguage interface from the ILanguage
Extension Point
of the CDT. The parser of the PL8 should not create an own
index, but
should add the functions of PL8 language to the index, created
by the
CDT-Parser.
If I click e.g. on a PL8-function in a C-file, the
C-indexer
searches for the function in the now combined index for the
location of
the function and jumps to it. If I click in a PL8-file, my own
indexer
searchs for the function in the combined index.
I think the solution is to implement the
getASTTranslationUnit
and my own ModelBuilder.
I tried to implement the
getASTTranslationUnit in this way.
public IASTTranslationUnit getASTTranslationUnit(CodeReader
reader,
IScannerInfo scanInfo,
ICodeReaderFactory fileCreator,
IIndex index,
IParserLogService log)
throws CoreException {
System.out.println("PL8Language::getASTTranslationUnit");
final ISourceCodeParser parser=
new
PL8SourceCodeParser(index);
// Parse
IASTTranslationUnit ast=
parser.parse();
return ast;
}
The parse function of my SourceCodeParser looks like
the
following:
public
IASTTranslationUnit parse() {
System.out.println("PL8SourceCodeParser::parse");
IASTTranslationUnit result;
//Create a new TranslationUnit
translationUnit = new CASTTranslationUnit();
translationUnit.setOffset(0);
translationUnit.setIndex(index);
//Name of the function
char name_str[] = {'A', 'B'};
CASTName declaratorName =
new
CASTName(name_str);
//new SimpleDeclaration
IASTSimpleDeclaration declaration = new
CASTSimpleDeclaration();
IASTStandardFunctionDeclarator declarator =
new
CASTFunctionDeclarator(declaratorName);
declaration.addDeclarator(declarator);
CASTSimpleDeclSpecifier
declSpec = new
CASTSimpleDeclSpecifier();
declaration.setDeclSpecifier(declSpec);
translationUnit.addDeclaration(declaration);
result = translationUnit;
translationUnit = null;
return result;
}
The goal is to add a function AB to
the index. But the current
situation is different. There is no function
with the name AB in the
index and at the moment I had no idea what the
reason is. The return
value of the parse function is the right one. The
return value has the
function included.
At the moment I found no other way to write into
the index,
which is used for the source code navigation.
I also searched for a solution in the CDT Wiki in
the topic
Design. It is clearly explained about the CDT works, but no
explanation
how I can implement my idea.
So my question to you, where is my mistake or is it
generally
possible to implement my idea?
Is there anything additional I have to do or can
you point me to
an example ?
Thank you in advance!
Kind
regards
Michael
-------------- next part --------------
An HTML attachment was
scrubbed...
URL:
https://dev.eclipse.org/mailman/private/cdt-dev/attachments/20081028/8c1918ac/attachment.html
------------------------------
Message:
2
Date: Tue, 28 Oct 2008 09:44:33 -0700
From: "Tom Ball"
<tball@xxxxxxxxxx>
Subject: Re: [cdt-dev] adding a new language to
the CDT
To: "CDT General developers list."
<cdt-dev@xxxxxxxxxxx>
Message-ID:
<ecf3d2390810280944j7a0a9666hde45fd8c90ebe868@xxxxxxxxxxxxxx>
Content-Type:
text/plain; charset=ISO-8859-1
I'm not a CDT expert, but what you
describe seems like a backwards
approach: JDT and CDT are purposely
specific to their respective
languages, so new languages should have their
own specific IDE support
rather than warp another language's. There
are several Eclipse
plug-in API packages to make this easier, such as LTK
which provides
common refactoring support. My suggestion is to write
separate IDE
support for your language, but use CDT and JDT as
best-of-class
example code.
Tom
On Tue, Oct 28, 2008 at 6:14
AM, Michael Rosenfelder
<MROSENFE@xxxxxxxxxx> wrote:
>
>
Hi,
> I'm working on an Eclipse Plug-In to support a procedural
programming
> language called PL8, a PL/I variant for systems
programming. We have PL8 and
> C source files in one source tree
(project). Our compiler builds all files
> to object files and then they
are linked together to one binary. It is
> possible to call a C-function
from a PL8-function and vice versa. So our
> idea was to use the CDT and
treat the source tree as a C/C++ project. The
> C/C++ files will be
handled by CDT and the PL8 files are handled by a PL8
> editor (Syntax
highlighting, outline view). We also want to use the code
> navigation
feature in the PL8 context. Therefore our idea was to add some
>
informations like function definitions in the C-index. We created a
Java
> class PL8Language implementing the ILanguage interface from the
ILanguage
> Extension Point of the CDT. The parser of the PL8 should not
create an own
> index, but should add the functions of PL8 language to
the index, created by
> the CDT-Parser.
> If I click e.g. on a
PL8-function in a C-file, the C-indexer searches for
> the function in
the now combined index for the location of the function and
> jumps to
it. If I click in a PL8-file, my own indexer searchs for the
> function
in the combined index.
>
> I think the solution is to implement
the getASTTranslationUnit and my own
> ModelBuilder.
> I tried to
implement the getASTTranslationUnit in this way.
>
> public
IASTTranslationUnit getASTTranslationUnit(CodeReader reader,
>
IScannerInfo scanInfo, ICodeReaderFactory
> fileCreator,
>
IIndex index, IParserLogService log) throws
> CoreException {
>
System.out.println("PL8Language::getASTTranslationUnit");
>
final ISourceCodeParser
parser= new
> PL8SourceCodeParser(index);
>
// Parse
>
IASTTranslationUnit ast=
parser.parse();
>
return ast;
>
>
}
>
> The parse function of my SourceCodeParser looks like the
following:
>
> public IASTTranslationUnit parse() {
>
System.out.println("PL8SourceCodeParser::parse");
>
IASTTranslationUnit result;
>
//Create a new
TranslationUnit
>
translationUnit = new CASTTranslationUnit();
>
translationUnit.setOffset(0);
>
translationUnit.setIndex(index);
>
>
//Name of the
function
> char
name_str[] = {'A', 'B'};
>
CASTName declaratorName = new
CASTName(name_str);
>
>
//new SimpleDeclaration
>
IASTSimpleDeclaration declaration = new
>
CASTSimpleDeclaration();
>
>
IASTStandardFunctionDeclarator declarator = new
>
CASTFunctionDeclarator(declaratorName);
>
declaration.addDeclarator(declarator);
>
>
CASTSimpleDeclSpecifier declSpec =
new
> CASTSimpleDeclSpecifier();
>
declaration.setDeclSpecifier(declSpec);
>
>
translationUnit.addDeclaration(declaration);
>
>
result = translationUnit;
>
translationUnit =
null;
>
>
return result;
> }
>
> The goal
is to add a function AB to the index. But the current situation is
>
different. There is no function with the name AB in the index and at
the
> moment I had no idea what the reason is. The return value of the
parse
> function is the right one. The return value has the function
included.
> At the moment I found no other way to write into the index,
which is used
> for the source code navigation.
>
> I also
searched for a solution in the CDT Wiki in the topic Design. It is
>
clearly explained about the CDT works, but no explanation how I can
>
implement my idea.
>
> So my question to you, where is my mistake
or is it generally possible to
> implement my idea?
> Is there
anything additional I have to do or can you point me to an example
>
?
>
> Thank you in advance!
>
> Kind
regards
>
> Michael
>
_______________________________________________
> cdt-dev mailing
list
> cdt-dev@xxxxxxxxxxx
>
https://dev.eclipse.org/mailman/listinfo/cdt-dev
>
>
------------------------------
Message:
3
Date: Tue, 28 Oct 2008 10:15:44 -0700
From: "Hilliard, Bill"
<bill.hilliard@xxxxxxxxx>
Subject: RE: [cdt-dev] adding a new
language to the CDT
To: "CDT General developers list."
<cdt-dev@xxxxxxxxxxx>
Message-ID:
<4AFE4AEEFA305C4BB82F73F4D819506006764D9A@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Content-Type: text/plain;
charset="us-ascii"
Actually, there is a goal of making CDT extendible
to support multiple
languages. See the "Vision Statement" slides on
the wiki from the Fall
2005 CDT summit. Also, see the Eclipse
technology Photran project which
builds a Fortran IDE over CDT. In
Addition, Doug S. has commented in
the past about his efforts to build an
Ada support package over CDT.
Jeff Overbey of the Photran project wrote a
white paper about adapting
CDT to other languages. You might see if
that has helpful information
for you.
Bill
-----Original
Message-----
From: cdt-dev-bounces@xxxxxxxxxxx
[mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Tom Ball
Sent:
Tuesday, October 28, 2008 12:45 PM
To: CDT General developers
list.
Subject: Re: [cdt-dev] adding a new language to the CDT
I'm
not a CDT expert, but what you describe seems like a backwards
approach:
JDT and CDT are purposely specific to their respective
languages, so
new languages should have their own specific IDE support
rather than warp
another language's. There are several Eclipse
plug-in API packages to
make this easier, such as LTK which provides
common refactoring support.
My suggestion is to write separate IDE
support for your language, but
use CDT and JDT as best-of-class
example code.
Tom
On Tue,
Oct 28, 2008 at 6:14 AM, Michael Rosenfelder
<MROSENFE@xxxxxxxxxx>
wrote:
>
> Hi,
> I'm working on an Eclipse Plug-In to
support a procedural programming
> language called PL8, a PL/I variant
for systems programming. We have
PL8 and
> C source files in one
source tree (project). Our compiler builds all
files
> to object
files and then they are linked together to one binary. It is
> possible
to call a C-function from a PL8-function and vice versa. So
our
>
idea was to use the CDT and treat the source tree as a C/C++
project.
The
> C/C++ files will be handled by CDT and the PL8 files
are handled by a
PL8
> editor (Syntax highlighting, outline view). We
also want to use the
code
> navigation feature in the PL8 context.
Therefore our idea was to add
some
> informations like function
definitions in the C-index. We created a
Java
> class PL8Language
implementing the ILanguage interface from the
ILanguage
> Extension
Point of the CDT. The parser of the PL8 should not create an
own
>
index, but should add the functions of PL8 language to the index,
created
by
> the CDT-Parser.
> If I click e.g. on a PL8-function in a
C-file, the C-indexer searches
for
> the function in the now combined
index for the location of the
function and
> jumps to it. If I click
in a PL8-file, my own indexer searchs for the
> function in the combined
index.
>
> I think the solution is to implement the
getASTTranslationUnit and my
own
> ModelBuilder.
> I tried to
implement the getASTTranslationUnit in this way.
>
> public
IASTTranslationUnit getASTTranslationUnit(CodeReader reader,
>
IScannerInfo scanInfo, ICodeReaderFactory
> fileCreator,
>
IIndex index, IParserLogService log) throws
> CoreException
{
>
System.out.println("PL8Language::getASTTranslationUnit");
>
final
ISourceCodeParser parser= new
> PL8SourceCodeParser(index);
>
// Parse
>
IASTTranslationUnit
ast= parser.parse();
>
return ast;
>
>
}
>
> The parse function of my SourceCodeParser looks like the
following:
>
> public IASTTranslationUnit parse() {
>
System.out.println("PL8SourceCodeParser::parse");
>
IASTTranslationUnit result;
>
//Create a new
TranslationUnit
>
translationUnit = new CASTTranslationUnit();
>
translationUnit.setOffset(0);
>
translationUnit.setIndex(index);
>
>
//Name of the
function
> char
name_str[] = {'A', 'B'};
>
CASTName declaratorName = new
CASTName(name_str);
>
>
//new SimpleDeclaration
>
IASTSimpleDeclaration declaration = new
>
CASTSimpleDeclaration();
>
>
IASTStandardFunctionDeclarator declarator = new
>
CASTFunctionDeclarator(declaratorName);
>
declaration.addDeclarator(declarator);
>
>
CASTSimpleDeclSpecifier declSpec =
new
> CASTSimpleDeclSpecifier();
>
declaration.setDeclSpecifier(declSpec);
>
>
translationUnit.addDeclaration(declaration);
>
>
result = translationUnit;
>
translationUnit =
null;
>
>
return result;
> }
>
> The goal
is to add a function AB to the index. But the current
situation is
>
different. There is no function with the name AB in the index and
at
the
> moment I had no idea what the reason is. The return value of
the parse
> function is the right one. The return value has the function
included.
> At the moment I found no other way to write into the index,
which is
used
> for the source code navigation.
>
> I
also searched for a solution in the CDT Wiki in the topic Design.
It
is
> clearly explained about the CDT works, but no explanation how
I can
> implement my idea.
>
> So my question to you, where
is my mistake or is it generally possible
to
> implement my
idea?
> Is there anything additional I have to do or can you point me to
an
example
> ?
>
> Thank you in advance!
>
>
Kind regards
>
> Michael
>
_______________________________________________
> 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
End
of cdt-dev Digest, Vol 44, Issue
52
***************************************