[antlr-interest] Reusing the text editor in ANTLRworks

Terence Parr parrt at cs.usfca.edu
Mon Oct 6 12:36:46 PDT 2008


Hi, AW is indeed a well structured development environment. Jean Bovet  
did an awesome job. I just asked myself about adding new syntax  
highlighting and so on for the new ANTLR tools coming soon to a  
theater near you. I asked him to give me a few words on all of the  
classes; here is how he responded:

> - ATESyntaxEngine: this is the main abstract class for the syntax  
> highlighting. It has several concrete classes. For example, to  
> highlight Java code, I use the ATEJavaSyntaxEngine which extends  
> ATELanguageSyntaxEngine which extends ATESyntaxEngine. This class  
> mainly creates the parser and lexer and define a few attributes.
> - ATESyntaxLexer: this is the lexer class. Again, for Java, I use  
> the ATEJavaSyntaxLexer extends ATELanguageLexer extends  
> ATESyntaxLexer.
> - ATESyntaxParser: same as the lexer but for the parser.
>
> The class GrammarSyntaxEngine is the engine for the grammar. It  
> extends, again, ATELanguageSyntaxEngine extends ATESyntaxEngine.
>
> We have that to summarize:
> - ATEJavaSyntaxEngine < ATELanguageSyntaxEngine < ATESyntaxEngine
> - GrammarSyntaxEngine < ATELanguageSyntaxEngine < ATESyntaxEngine
>
> So if you want to create something for a new language, I would mimic  
> the ATEJavaXXX classes and adapt them to your language.
>
> The ANTLRGrammarEngine (and impl) is used as a wrapper around your  
> org.antlr.tool.Grammar.

Terence



More information about the antlr-interest mailing list