[il-antlr-interest: 31311] [antlr-interest] tree grammar and list via +=

2011-02-02 Thread Bastian Asam
Hello again, since you helped me nicely last time a have an other question: Is it now possible to use a list in a tree grammar? I found a mail from 2007 saying it will be implemented soon. But when I try it, I get a very long error Message. Here is the grammar: tree grammar TreeWalker; options{

[il-antlr-interest: 31313] Re: [antlr-interest] Memory management of C target

2011-02-02 Thread Marco Trudel
Dear Jim On 01.02.2011 18:15, Jim Idle wrote: > > > I think > that in 3.3 I have fixed a bug that was not releasing memory references > when building a tree until the tree was freed. Try making a version that > does not build a tree and see how it differs. > > Ok, made a version of my grammar t

[il-antlr-interest: 31314] Re: [antlr-interest] Memory management of C target

2011-02-02 Thread Jim Idle
I think that the fix is in there, which means that your input is too big to build the tree in the way it is being done. Write an input stream wrapper that splits the input by just returning EOF at the split point then resets to the next unit. How are you ending up with 640,000 lines of C input? J

[il-antlr-interest: 31315] [antlr-interest] SLL(2) in "The Definitive ANTLR Reference"

2011-02-02 Thread Alan D. Cabrera
I was reading about the following grammar on page 287 of the PDF document grammar t; s : X r A B | Y r B ; r : A | ; I don't see where the problem is since the alternatives in s begin with two different tokens X and Y. I think that since these two tokens are different I can easily con

[il-antlr-interest: 31316] Re: [antlr-interest] Memory management of C target

2011-02-02 Thread Marco Trudel
On 02.02.2011 18:01, Jim Idle wrote: > I think that the fix is in there, which means that your input is too big > to build the tree in the way it is being done. Write an input stream > wrapper that splits the input by just returning EOF at the split point > then resets to the next unit. Actually I

[il-antlr-interest: 31317] [antlr-interest] JOB: Senior Software Engineer with Parsing Expertise needed at CISCO

2011-02-02 Thread breroger
Please contact Brent at brero...@cisco.com if you are interested in the job opening listed below. Regards, Brent Senior Software Engineer Location ­ San Jose, California Security Technology Business Unit (STBU) within WSRTG, is seeking a Software Engineer. STBU offers network and content sec

[il-antlr-interest: 31318] Re: [antlr-interest] SLL(2) in "The Definitive ANTLR Reference"

2011-02-02 Thread Terence Parr
try for rule 'r' though ;) Ter On Feb 2, 2011, at 9:07 AM, Alan D. Cabrera wrote: > I was reading about the following grammar on page 287 of the PDF document > > grammar t; > s : X r A B > | Y r B > ; > > r : A > | > ; > > I don't see where the problem is since the alternatives in s begin w

[il-antlr-interest: 31319] [antlr-interest] Question of Repetead tokens and early termination

2011-02-02 Thread Victor Giordano
Hi there. I am having trouble with the error handling. I have a grammar for recoignize linear expression. And it works great!. The grammar for a linear expresion is the following: tokens { PLUS= '+'; MINUS = '-'; MUL = '*'; DIV = '/'; }

[il-antlr-interest: 31320] Re: [antlr-interest] SLL(2) in "The Definitive ANTLR Reference"

2011-02-02 Thread Sam Harwell
The problem is the decision inside rule r. Since ANTLR uses lookahead only (as opposed to lookbehind), the decision making doesn't know which instance of r is being parsed. The following would resolve the issue: s : X r1 A B | Y r2 B ; r1 : A | ; r2 : A | ; -Original Message- From:

[il-antlr-interest: 31321] Re: [antlr-interest] Question of Repetead tokens and early termination

2011-02-02 Thread John B. Brodie
Your grammar does not mention the EOF token. (more below...) On Wed, 2011-02-02 at 16:18 -0300, Victor Giordano wrote: > Hi there. I am having trouble with the error handling. > I have a grammar for recoignize linear expression. And it works great!. > The grammar for a linear expresion is the follo

[il-antlr-interest: 31322] Re: [antlr-interest] SLL(2) in "The Definitive ANTLR Reference"

2011-02-02 Thread Alan D. Cabrera
Ahh, the DFA for the 'r' rule. That makes sense now. Interesting example. Thanks Terence and Sam! Regards, Alan On Feb 2, 2011, at 11:17 AM, Terence Parr wrote: > try for rule 'r' though ;) > Ter > On Feb 2, 2011, at 9:07 AM, Alan D. Cabrera wrote: > >> I was reading about the following gra

[il-antlr-interest: 31324] [antlr-interest] LL(*) paper accepted to PLDI 2011

2011-02-02 Thread Terence Parr
Here's a draft of "LL(*): The Foundation of the ANTLR Parser Generator" http://www.antlr.org/papers/LL-star-PLDI11.pdf Explains the LL(*) parsing strategy and ANTLR's analysis algorithm that builds LL(*) parsers. [warning: written for academic audiences.] Ter List: http://www.antlr.org/mailman

[il-antlr-interest: 31325] Re: [antlr-interest] Question of Repetead tokens and early termination

2011-02-02 Thread Victor Giordano
Thanks for your anwser John. Your explanation was very clear and most welcome!. Thinks seem to go better beacuse kwow the parser is throwing an MissingTokenExeption. I will capture and use it for the cause!! Grettins and thanks again!. Víctor. El 02/02/2011 05:32 p.m., John B. Brodie escribió:

[il-antlr-interest: 31326] Re: [antlr-interest] tree pattern matching rewrite bug ?

2011-02-02 Thread Michael Bedward
Just a little more on the issue below, when I swapped the tree grammars that were provoking the "Can't set single child to a list" error from pattern matching mode (filter = true) to complete grammars (filter = false) the tree rewrites run successfully. I'd still be interested to hear if issue AN

[il-antlr-interest: 31327] [antlr-interest] Which approach for an Interpreter: Tree Grammar vs AST-Visitor

2011-02-02 Thread bill punch
I'm designing a project for my compiler class, and we are at the stage of building an interpreter for our grammar. Before going farther, let me say first that ANTLR is great and makes the whole process a lot easier. However, I'm converting the course and, being new to ANTLR, have a few questions. H

[il-antlr-interest: 31328] [antlr-interest] Catching errors

2011-02-02 Thread Victor Giordano
Okey. So adding and EOF forces the parser to go to the end of the input in search of others tokens in correct order. 1)But a still have a problem, consider the following grammar: grammar LinearMath; tokens { PLUS = '+'; MINUS = '-'; MUL= '*'; DIV= '/'

[il-antlr-interest: 31329] Re: [antlr-interest] Catching errors

2011-02-02 Thread Victor Giordano
[Updated]I am watching when i use the generated lexer and parser (Generated from the LinearMath grammar below) in a java application is that do really emit somekind of warning about two thinks: 1)extraneous input '' expecting EOF *Only when a append the EOF token at the end of the rule* 2)requi

[il-antlr-interest: 31330] Re: [antlr-interest] Which approach for an Interpreter: Tree Grammar vs AST-Visitor

2011-02-02 Thread Hiran Chaudhuri
>So would it be better to have an example like the Pie language use a >tree grammar or is the hand-written visitor code a better approach? What >are the pros and cons? Any help appreciated. A pure interpreter would read statements one by one and execute them directly. A compiler would read the who