Hi,

I guess this is the problem Ter talks about in this mail:
http://marc.info/?l=antlr-dev&m=121174142722552&w=2

Wondering if this bug is fixed or is still there...

- Indhu

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Indhu Bharathi
Sent: Thursday, April 02, 2009 10:58 PM
To: antlr-interest
Subject: [antlr-interest] Composite grammar and memoize

Hi,

It looks like memoize at rule level doesn't work in composite grammar. I 
get the error message '!!!!!!!!! memo array is null for ParserPart.g'. 
'state.ruleMemo' is always null.

Also, it looks like this is a known issue. Has this been fixed or is 
there a workaround?

I tried turning on memoize at grammar level and turn it off in the rules 
that doesn't require it. Even that doesn't seem to work.

Here are the files I used:

LexerPart.g
lexer grammar LexPart;

SET    :    'set'
    ;
       
EQ    :    '='
    ;
   
SEMICOLON   
    :    ';'
    ;
   
COLON
    :    ':'
    ;       
   
LPAREN    :    '('
        ;
       
RPAREN    :    ')'
        ;
   
PLUS
    :    '+'
    ;
   
ID    :    'a'..'z'+
    ;
   
INTLIT    :    '0'..'9'+
    ;
   
WS    :    (' ' | '\t'  | '\r') {$channel = HIDDEN;}
    ;
   



ParserPart.g
parser grammar ParserPart;


s   
options {
    backtrack = true;
    memoize = true;
}
    :    r
    |    expr ID
    ;

r
options {
    backtrack = true;
    memoize = true;
}
    :    expr SEMICOLON
    |    expr COLON
    ;
   
expr
        : LPAREN expr RPAREN
        | INTLIT
        ;
   


Child1.g
grammar Child1;

import LexPart, ParserPart;

@header {
    import java.util.LinkedList;
    import org.antlr.runtime.*;
   
}

test    : PLUS
        ;
       

Any pointers?


Thanks, Indhu


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to