Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » OT/J Parser
OT/J Parser [message #507227] Tue, 12 January 2010 14:31 Go to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1034
Registered: July 2009
Senior Member
I've repeatedly been asked about a parser for OT/J that can be
used in third party tools.

For all you potential tool developers, the preferred option should
be to directly use the Eclipse DOM AST, which contains all OT/J
extensions. Instead of directly accessing a parser you might start
at JDT resources like these:

To find out about the AST with OT/J extensions just look at

http://trac.objectteams.org/ot/browser/trunk/src/plugins/org .eclipse.jdt.core/dom/org/eclipse/jdt/core/dom

This option might imply that your tools become Eclipse plugins, too,
which isn't a bad idea, I guess. Should you need to run your tool
standalone you just need a number of Eclipse plugins on you classpath.

If you still want to play with a parser of your own, I might send you
a JavaCC grammar for OT/J. This grammar is somewhat outdated and only
marginally tested - so you're warned.

Finally, the original OT/J grammar used for the OT/J compiler is not
recommended for use outside the compiler, because the grammar is
optimized more for being strictly LALR(1) than for readability.
It is only useful in conjunction with the parser which contains
some more handcoded syntax checks and which is also optimized for
recovery after syntax errors. You wouldn't want to bother with such
details in your tool.

So, with the DOM AST option you're directly working on tested code,
without worrying about the particulars of a highly tuned parser.
How's that?

HTH,
Stephan

[Updated on: Fri, 22 January 2010 21:45]

Report message to a moderator

Re: OT/J Parser [message #531237 is a reply to message #507227] Tue, 04 May 2010 09:46 Go to previous messageGo to next message
Arlindo is currently offline ArlindoFriend
Messages: 33
Registered: August 2009
Member
Hi,

Can I ask you for the JavaCC grammar and the original OT/J grammar used for the OT/J compiler, just in case... although I'm thinking of using the Eclipse DOM AST.

Just to be sure: the AST with OT/J extensions in the link you provide is the latest one, or is there an updated version (since the move to eclipse.org)?

Thanks.
Re: OT/J Parser [message #532180 is a reply to message #531237] Fri, 07 May 2010 12:46 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1034
Registered: July 2009
Senior Member
Hi Arlindo,

sorry for not answering sooner!

Arlindo wrote on Tue, 04 May 2010 05:46
Hi,

Can I ask you for the JavaCC grammar and the original OT/J grammar used for the OT/J compiler, just in case...


The JavaCC grammar hasn't been maintained nor is it very much tested.
Also the copyright is unclear. Now that I warned you, you can find the file at
http://www.objectteams.org/tmp/Java1.5x-OTJ.jjt
The current grammar in use by the OTDT is
http://dev.eclipse.org/svnroot/tools/org.eclipse.objectteams /trunk/plugins/org.eclipse.jdt.core/grammar/otj.g


Quote:

although I'm thinking of using the Eclipse DOM AST.


good Smile
Quote:

Just to be sure: the AST with OT/J extensions in the link you provide is the latest one, or is there an updated version (since the move to eclipse.org)?

Thanks.


You're right, the address has changed, so for the latest versions use this repository URL:
http://dev.eclipse.org/svnroot/tools/org.eclipse.objectteams
You'll find our version of the DOM AST at this relative path:
trunk/plugins/org.eclipse.jdt.core/dom

Hope that helps,
Stephan

Re: OT/J Parser [message #536885 is a reply to message #532180] Mon, 31 May 2010 11:43 Go to previous messageGo to next message
Arlindo is currently offline ArlindoFriend
Messages: 33
Registered: August 2009
Member
Stephan Herrmann wrote on Fri, 07 May 2010 13:46
You're right, the address has changed, so for the latest versions use this repository URL:
http://dev.eclipse.org/svnroot/tools/org.eclipse.objectteams

You'll find our version of the DOM AST at this relative path:
trunk/plugins/org.eclipse.jdt.core/dom

Hope that helps,
Stephan


Hi Stephan,

I built an eclipse project with the code in the URL you gave me (only the trunk/plugins/org.eclipse.jdt.core/dom fragment).

Unfortunately, I'm getting a "Java Problem" error in the file org/eclipse/jdt/core/dom/ASTConverter.java (line 3622):

isAfter cannot be resolved or is not a field.
(referring to the code snippet aPrecedence.isAfter, being aPrecendence an object of the type org.eclipse.objectteams.otdt.internal.core.compiler.ast.Prec edenceDeclaration)

Can this be an import problem? I even added the all the JARs in <eclipse folder>/plugins, but nothing changed.

Is there something special I must do to build a project with the OT/J AST code?


Thanks.

P.S.: I'm using the latest OTDT 0.7.0 M2
Re: OT/J Parser [message #536894 is a reply to message #536885] Mon, 31 May 2010 12:42 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1034
Registered: July 2009
Senior Member
Hi Arlindo,

Arlindo wrote on Mon, 31 May 2010 07:43

[...]
Unfortunately, I'm getting a "Java Problem" error in the file org/eclipse/jdt/core/dom/ASTConverter.java (line 3622):

isAfter cannot be resolved or is not a field.
(referring to the code snippet aPrecedence.isAfter, being aPrecendence an object of the type org.eclipse.objectteams.otdt.internal.core.compiler.ast.Prec edenceDeclaration)

Can this be an import problem? I even added the all the JARs in <eclipse folder>/plugins, but nothing changed.
[...]
P.S.: I'm using the latest OTDT 0.7.0 M2


You have some kind of inconsistency in your sources:
Field isAfter has been added in SVN revision 354 (which happened post M2).
Seemingly your class PrecedenceDeclaration is older than that revision.
So please check the SVN revisions of both files in your workspace.

Also, when you check out only the dom source folder, you should be aware that
other classes will be referenced from you host Eclipse installation.
This can also introduce incompatibilities. However, for PrecedenceDeclaration
that shouldn't be the case as both classes involved are contained in the dom
source folder.

Hope that helps?
Stephan

PS: if you update to Helios RC3 plus today's OTDT Milestone 3 you might want
to freeze your checked-out sources to revision 402, which corresponds to the
released build. That should guarantee consistent versions.
Re: OT/J Parser [message #536910 is a reply to message #536894] Mon, 31 May 2010 13:24 Go to previous messageGo to next message
Arlindo is currently offline ArlindoFriend
Messages: 33
Registered: August 2009
Member
Updating to Helios RC3 plus today's OTDT Milestone 3 solved the problem, indeed.
Could have been an inconsistency between revisions, like you said.

Thanks.
Re: OT/J Parser [message #574097 is a reply to message #507227] Tue, 04 May 2010 09:46 Go to previous messageGo to next message
Arlindo is currently offline ArlindoFriend
Messages: 33
Registered: August 2009
Member
Hi,

Can I ask you for the JavaCC grammar and the original OT/J grammar used for the OT/J compiler, just in case... although I'm thinking of using the Eclipse DOM AST.

Just to be sure: the AST with OT/J extensions in the link you provide is the latest one, or is there an updated version (since the move to eclipse.org)?

Thanks.
Re: OT/J Parser [message #574164 is a reply to message #574097] Fri, 07 May 2010 12:46 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1034
Registered: July 2009
Senior Member
Hi Arlindo,

sorry for not answering sooner!

Arlindo wrote on Tue, 04 May 2010 05:46
> Hi,
>
> Can I ask you for the JavaCC grammar and the original OT/J grammar used for the OT/J compiler, just in case...

The JavaCC grammar hasn't been maintained nor is it very much tested.
Also the copyright is unclear. Now that I warned you, you can find the file at
http://www.objectteams.org/tmp/Java1.5x-OTJ.jjt
The current grammar in use by the OTDT is
http://dev.eclipse.org/svnroot/tools/org.eclipse.objectteams /trunk/plugins/org.eclipse.jdt.core/grammar/otj.g


Quote:
> although I'm thinking of using the Eclipse DOM AST.

good :)
Quote:
> Just to be sure: the AST with OT/J extensions in the link you provide is the latest one, or is there an updated version (since the move to eclipse.org)?
>
> Thanks.


You're right, the address has changed, so for the latest versions use this repository URL:
http://dev.eclipse.org/svnroot/tools/org.eclipse.objectteams
You'll find our version of the DOM AST at this relative path:
trunk/plugins/org.eclipse.jdt.core/dom

Hope that helps,
Stephan
Re: OT/J Parser [message #574271 is a reply to message #574164] Mon, 31 May 2010 11:43 Go to previous messageGo to next message
Arlindo is currently offline ArlindoFriend
Messages: 33
Registered: August 2009
Member
Stephan Herrmann wrote on Fri, 07 May 2010 13:46
> You're right, the address has changed, so for the latest versions use this repository URL:
> http://dev.eclipse.org/svnroot/tools/org.eclipse.objectteams
>
> You'll find our version of the DOM AST at this relative path:
> trunk/plugins/org.eclipse.jdt.core/dom
>
> Hope that helps,
> Stephan


Hi Stephan,

I built an eclipse project with the code in the URL you gave me (only the trunk/plugins/org.eclipse.jdt.core/dom fragment).

Unfortunately, I'm getting a "Java Problem" error in the file org/eclipse/jdt/core/dom/ASTConverter.java (line 3622):

isAfter cannot be resolved or is not a field.
(referring to the code snippet aPrecedence.isAfter, being aPrecendence an object of the type org.eclipse.objectteams.otdt.internal.core.compiler.ast.Prec edenceDeclaration)

Can this be an import problem? I even added the all the JARs in <eclipse folder>/plugins, but nothing changed.

Is there something special I must do to build a project with the OT/J AST code?


Thanks.

P.S.: I'm using the latest OTDT 0.7.0 M2
Re: OT/J Parser [message #574339 is a reply to message #574271] Mon, 31 May 2010 12:42 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1034
Registered: July 2009
Senior Member
Hi Arlindo,

Arlindo wrote on Mon, 31 May 2010 07:43
> [...]
> Unfortunately, I'm getting a "Java Problem" error in the file org/eclipse/jdt/core/dom/ASTConverter.java (line 3622):
>
> isAfter cannot be resolved or is not a field.
> (referring to the code snippet aPrecedence.isAfter, being aPrecendence an object of the type org.eclipse.objectteams.otdt.internal.core.compiler.ast.Prec edenceDeclaration)
>
> Can this be an import problem? I even added the all the JARs in <eclipse folder>/plugins, but nothing changed.
> [...]
> P.S.: I'm using the latest OTDT 0.7.0 M2


You have some kind of inconsistency in your sources:
Field isAfter has been added in SVN revision 354 (which happened post M2).
Seemingly your class PrecedenceDeclaration is older than that revision.
So please check the SVN revisions of both files in your workspace.

Also, when you check out only the dom source folder, you should be aware that
other classes will be referenced from you host Eclipse installation.
This can also introduce incompatibilities. However, for PrecedenceDeclaration
that shouldn't be the case as both classes involved are contained in the dom
source folder.

Hope that helps?
Stephan

PS: if you update to Helios RC3 plus today's OTDT Milestone 3 you might want
to freeze your checked-out sources to revision 402, which corresponds to the
released build. That should guarantee consistent versions.
Re: OT/J Parser [message #574369 is a reply to message #536894] Mon, 31 May 2010 13:24 Go to previous message
Arlindo is currently offline ArlindoFriend
Messages: 33
Registered: August 2009
Member
Updating to Helios RC3 plus today's OTDT Milestone 3 solved the problem, indeed.
Could have been an inconsistency between revisions, like you said.

Thanks.
Previous Topic:OTDT 0.7.0 M3 - approaching Helios
Next Topic:OTDT 0.7.0 M4 - getting closer
Goto Forum:
  


Current Time: Fri Nov 21 16:51:02 GMT 2014

Powered by FUDForum. Page generated in 0.03275 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software