[antlr-interest] Re: ANTLR+Eclipse
Thomas Brandon
tom at psy.unsw.edu.au
Tue Jul 20 20:08:50 PDT 2004
The Antlr eclipse plugin implements such functionality. It does
syntax highlighting and produces an outline of the grammar. I'm not
100% familiar with the code but it appears to be using the builtin
Eclipse support to do the syntax highlighting and an Antlr parser to
do the outline view. The reconciling strategy handles document
changes by simply reparsing the whole document upon any change. This
also means the whole source model must be discarded each parse.
There does not appear to be any support for tracking changes at a a
lower-level which would become more critical if other, more
complicated, tools are consuming the source model. I'm not sure how
good the performance would be if this method was used for lower-
level features such as syntax highlighting or code completion which
require more frequent updates. The Netbeans project implemented
incremental lexing on top of an Antlr based lexer
(lexer.netbeans.org), perhaps you could port something like that to
Eclipse. Incremental parsing in Antlr seems to be a more difficult
prospect (though Antlr 3 may make this easier). Batch parsing on top
of incremental lexing may be good enough for code-completion and the
like.
Tom.
--- In antlr-interest at yahoogroups.com, "Tiller, Michael \(M.M.\)"
<mtiller at f...> wrote:
> I was wondering if anybody had ever tried to use ANTLR to
implement a
> scanner in Eclipse. I'm not talking about a plug-in to Eclipse to
> facilitate grammar development, I'm talking about the reverse.
> Specifically, a tool that can scan the document associated with an
> editor in Eclipse and pull out information about the locations of
> keywords, comments, etc. and then integrated this into the Eclipse
> framework for identifying tokens, doing completion, etc.
>
> It seems like all that would be required would be to interface the
lexer
> to the Eclipse representation of a document (so you could scan the
> characters in the document) and then somehow tuck the results away
so
> that subsequent calls to specialized token scanners, etc. wouldn't
even
> look at the document but would instead just return information
based on
> walking the AST.
>
> So, has anybody done this? It seems like this would be a great
> cornerstone for plug-in development because you could do real
parsing
> rather than relying on the (what appear to be) rather crude
primitives
> in Eclipse for doing this kind of thing.
>
> --
> Mike
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list