jGuru
Register Email     Password Forgot your
password?
HOME FAQS FORUMS DOWNLOADS ARTICLES PEERSCOPE LEARN

  Search   jGuru Search Help

View:
ANTLR FAQ Home Page

FAQ Manager is guru Terence Parr PREMIUM.

ANTLR is a groovy and widely-used open-source parser and translator generator tool supported by those hip cats at jGuru.

What's New

What is the difference between using "a" and A in the parser if I have rule A : "a"; in the Lexer?
Tools:ANTLR:Recognition:Lexical analysis, Tools:ANTLR:Recognition:Vocabulary
Terence Parr PREMIUM, Jan 23, 2003
Imagine input: class P extends Parser; a : "a" A ; class L extends Lexer; A : "a"; ANTLR will think "a" and A are two different tokens...
How do I convert my PCCTS grammar to ANTLR?
Tools:ANTLR:C++
Terence Parr PREMIUM, Aug 20, 2002
Check out the article describing conversion of the old C++ grammar to new ANTLR. This is based on Tom Nurkkala's original article.
Is ANTLR appropriate for building a line-oriented preprocessor like the C preprocessor or m4?
Tools:ANTLR:Using recognizer objects
Terence Parr PREMIUM, May 27, 2002
Greg Lindholm points out: ANTLR doesn't have a way of specifing start-of-line as part of a rule. Once you have entered a rule you can use a sematic...

What is a tree parser and why would I want to use one?
Tools:ANTLR:Intermediate forms:Node types, Tools:ANTLR:Intermediate forms:Trees, Tools:ANTLR:Recognition:Tree parsing, Tools:ANTLR:Translation
Terence Parr PREMIUM, Mar 31, 2002
Only simple, so-called syntax directed translations can be done with actions within the parser. These kinds of translations can only spit out constructs...
What's the difference between a parse tree and an abstract syntax tree (AST)? Why doesn't ANTLR generate trees with nodes for grammar rules like JJTree does?
Tools:ANTLR:Intermediate forms:Trees, Tools:ANTLR:Translation
Terence Parr PREMIUM, Mar 27, 2002
A parse tree is a record of the rules (and tokens) used to match some input text whereas a syntax tree records the structure of the input and is insensitive...
How do I build a source-to-source translator in ANTLR? What is the basic strategy?
Tools:ANTLR:Intermediate forms:Trees, Tools:ANTLR:Translation
Terence Parr PREMIUM, Feb 14, 2002
In most general terms, the strategy for building a translator can be summarized as follows: Parse the input file(s) in the old language, constructing...
Why does ANTLR say that two of my lexer rules are ambiguous? Or, why am I having so much trouble with DOT or PERIOD at the left-edge of lexer rules?
Tools:ANTLR:Grammars:Ambiguity, Tools:ANTLR:Grammars:Left-factoring, Tools:ANTLR:Grammars:Nondeterminism, Tools:ANTLR:Recognition:Lexical analysis
Terence Parr PREMIUM, Feb 4, 2002
Imagine that your grammar (prolog) has two types of tokens that begin with DOT (the period symbol). Specifically the "." may appear alone as the end...
Why are trees not built properly when I manually manipulate the return tree (with an action) for a rule?
Tools:ANTLR:Intermediate forms:Automatic AST construction, Tools:ANTLR:Intermediate forms:Trees
Terence Parr PREMIUM, Feb 2, 2002
Generally the problem is that you cannot use manual tree construction actions within a rule that is doing automatic tree construction--you confuse the...
How can I track the character position within an input file? I want know at what index does a token start.
Tools:ANTLR:Recognition:Lexical analysis, Tools:ANTLR:Tokens
Sriram Srinivasan, Nov 18, 2001
One way is to implement your own input stream and to override all the read() methods (much like FilterInputStream). You can supply an instance of...
Can I push back the most recently read token into the input stream?
Tools:ANTLR:Recognition:Lookahead, Tools:ANTLR:Recognition:Syntactic predicates
Terence Parr PREMIUM, Oct 27, 2001
You are thinking in terms of the old one-token-of-lookahead type parser generators without backtracking capabilities. ANTLR specifically provides a mechanism...
Is there a C++ grammar for ANTLR? Is it even possible to parse C++ with a conventional grammar?
Tools:ANTLR:Grammars:Ambiguity, Tools:ANTLR:Recognition:Parsing, Tools:ANTLR:Recognition:Syntactic predicates
Terence Parr PREMIUM, Oct 27, 2001
Update: There is a C++ grammar now for ANTLR, converted from old PCCTS: here. The simple answer is that C++ is pretty much impossible to parse by merely...
Why can't I get the exportVocab/importVocab directives to work with string literals across multiple files?
Tools:ANTLR:Recognition:Vocabulary, Tools:ANTLR:Grammars:Inheritance
Ric Klaren, Oct 27, 2001
Christopher writes: The literal ".accept" matches using this set of import/export rules: class TestingParser extends Parser; options { expor...
ANTLR generates methods for rules that are too complex/large for my compiler. What can I do?
Tools:ANTLR:Grammars:Rules
Terence Parr PREMIUM, Oct 16, 2001
You can break up your large rule into a chain instead of one big alternative list like the following: a : T1 | T2 | T3 | b ; b : T4 | T5 | T6 |...
How do I parse a formula? I have a string containing a mathematical formula formula like "144/12". How do I calculate its value?
Tools:ANTLR, Java:Language
David Cole, Aug 20, 2001
[Jo Desmet has created a forumla parser package called JMEP (or com.neemsoft.jmep). Write him at Jo_Desmet@yahoo.com to learn more. Maybe with enough...
Why does my lexer not recognize a token that is a substring of another token? I get no nondeterminism warnings, but I do get a run-time recognition exception.
Tools:ANTLR:Grammars:Nondeterminism, Tools:ANTLR:Recognition:Lexical analysis
Terence Parr PREMIUM, Jul 20, 2001
Imagine a grammar with k=3 and the following rules: STAR : '*' ; TRISTAR : "***" ; Given input **, you want the lexer to match STAR twice when...
When will the next version of ANTLR be released?
Tools:ANTLR
Terence Parr PREMIUM, Jul 19, 2001
Unfortunately, ANTLR releases are subject to the availability of Terence Parr's time and the time of people like Ric Klaren, the C++ output person. That...
How can I filter an input file for only those constructs I care about, ignoring everything else? Or, how can I get ANTLR to operate like SED or AWK?
Tools:ANTLR:Recognition:Lexical analysis, Tools:ANTLR:Translation:Filtering
Terence Parr PREMIUM, Jul 19, 2001
SED and AWK are great tools bestowed upon us from the great Uncle UNIX. They have one serious limitation, however: the tools are line-oriented and cannot...
I'm getting bizarre compile errors when compiling my parser? Is it because I'm using BEA/WebLogic, which also uses ANTLR?
Tools:ANTLR
Terence Parr PREMIUM, Jul 19, 2001
Yes, if you get errors like this: CalcLexer.java:37: The method antlr.Token nextToken() declared in class CalcLexer cannot override the method of...
How do I trap exceptions generated from any lexical rule using a single exception handler?
Tools:ANTLR:Recognition:Exceptions, Tools:ANTLR:Translation:Filtering
Terence Parr PREMIUM, Jul 19, 2001
Currently there is no way to specify an exception handler for the generated nextToken method (since you don't specify the rule itself). The best way to...
My lexer (generated in C++) seems slower than table-driven lexers like lex. Is there anything I can do?
Tools:ANTLR:C++, Tools:ANTLR:Speed:Lexer
Terence Parr PREMIUM, Jul 19, 2001
According to Ric Klaren, an istringstream object should do the trick. He also has an example, flexLex in the examples/cpp directory of the distribution,...
« previous beginning next »


Ask A Question



Related Links

ANTLR Forum

Download now!

Resources

Documentation

Book in progress

ANTLR Consulting

Wish List
Features
About jGuru
Contact Us

 




JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
Avaya Article: Call Control XML - Powerful, Standards-Based Call Control
Internet.com eBook: The Pros and Cons of Outsourcing
Go Parallel Article: Scalable Parallelism with Intel(R) Threading Building Blocks
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
Go Parallel Article: James Reinders on the Intel Parallel Studio Beta Program
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Go Parallel Article: Getting Started with TBB on Windows
HP eBook: Storage Networking , Part 1
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Go Parallel Video: Intel(R) Threading Building Blocks: A New Method for Threading in C++
HP Video: Is Your Data Center Ready for a Real World Disaster?
Microsoft Partner Portal Video: Microsoft Gold Certified Partners Build Successful Practices
HP On Demand Webcast: Virtualization in Action
Go Parallel Video: Performance and Threading Tools for Game Developers
Rackspace Hosting Center: Customer Videos
Intel vPro Developer Virtual Bootcamp
HP Disaster-Proof Solutions eSeminar
HP On Demand Webcast: Discover the Benefits of Virtualization
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Microsoft Download: Silverlight 2 Software Development Kit Beta 2
30-Day Trial: SPAMfighter Exchange Module
Red Gate Download: SQL Toolbelt
Iron Speed Designer Application Generator
Microsoft Download: Silverlight 2 Beta 2 Runtime
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
IBM IT Innovation Article: Green Servers Provide a Competitive Advantage
Microsoft Article: Expression Web 2 for PHP Developers--Simplify Your PHP Applications
Featured Algorithm: Intel Threading Building Blocks - parallel_reduce
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES