OT/J Parser [message #567425] |
Tue, 12 January 2010 14:31 |
Stephan Herrmann Messages: 1853 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:
http://www.eclipse.org/articles/article.php?file=Article-
JavaCodeManipulation_AST/index.html
http://www.vogella.de/articles/EclipseJDT/article.html
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
|
|
|
Powered by
FUDForum. Page generated in 0.03417 seconds