Related articles |
---|
ANTLR 2.5.0 released parrt@parr-research.com (Terence Parr) (1998-11-30) |
From: | Terence Parr <parrt@parr-research.com> |
Newsgroups: | comp.compilers.tools.pccts,comp.compilers |
Date: | 30 Nov 1998 02:13:43 -0500 |
Organization: | MageLang Insitute |
Keywords: | tools, PCCTS, available |
Hi folks,
Just a note to tell people that the 2.5.0 version of the ANTLR
translator generator has been released. Download it at
http://www.antlr.org/download.html or see the full release notes at
http://www.antlr.org/doc/antlr250release.html
Below I have included a brief description about a great new feature.
Also note that the Java and HTML grammars have been significantly
improved. For example, the Java parser handles all the inner class
goodies, builds trees, and includes a tree grammar that walks the
trees; the trees can be displayed visually using the
antlr.debug.ASTFrame class.
As always, the source and the Java/C++ output are public domain; no
restrictions of any kind (not even a copyright).
Best regards,
Terence
-----------------------------------
The big new feature is "lexical filtering" (Uber-AWK?). You often want
to perform an action upon seeing a pattern or two in a complicated
input stream, such as pulling out links in an HTML file. One solution
is to take the HTML grammar and just put actions where you want.
Using a complete grammar is overkill and you may not have a complete
grammar to start with.
ANTLR provides a mechanism similar to AWK that lets you say "here are
the patterns I'm interested in--ignore everything else." Naturally,
AWK is limited to regular expressions whereas ANTLR accepts
context-free grammars. For example, consider pulling out the <p> and
<br> tags from an arbitrary HTML file. Using the filter option, this
is easy:
class T extends Lexer;
options {
k=2; // see past the initial '<' to the 'p' or 'b'
filter=true;
}
P : "<p>" {do-something;} ;
BR: "<br>" {do-another-thing;} ;
In this "mode", there is no possibility of a syntax error. Either the
pattern is matched exactly or it is filtered out.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.