[antlr-interest] Backtracking and labels

Kieran Simpson kierans777 at gmail.com
Sun Mar 11 01:02:48 PST 2012


As a follow up, I checked out the antlr3 repo from Git Hub and built the 
current master branch.  Still have the same problem

[java] '-classpath'
[java] 
'./lib/ST4-4.0.4.jar:./lib/antlr-2.7.7.jar:./lib/antlr-3.4.1-SNAPSHOT.jar:./lib/antlr-runtime-3.4.1-SNAPSHOT.jar:./lib/stringtemplate-3.2.1.jar'

Cheers,

On 11/03/12 5:43 PM, Kieran Simpson wrote:
> @Bart - yes you're right, I forgot to add the leading ^ for the
> resulting AST in my example. Typo :(
>
> @Ivan - I ran my build with Antlr 3.3 and the resulting code is OK
>
> static void synpred9_CoreConfiguration_fragment(pCoreConfigurationParser
> ctx )
> {
> pANTLR3_COMMON_TOKEN value;
>
> value = NULL;
>
> However I want to use 3.4 ;)
>
> I was thinking it might be a classpath issue, however I'm not certain.
> The classpaths are (from my Ant build):
>
> [java] '-classpath'
> [java]
> './lib/ST4-4.0.4.jar:./lib/antlr-2.7.7.jar:./lib/antlr-3.4.jar:./lib/antlr-runtime-3.4.jar:./lib/stringtemplate-3.2.1.jar'
>
>
> [java] '-classpath'
> [java]
> './lib/antlr-2.7.7.jar:./lib/antlr-3.3.jar:./lib/antlr-runtime-3.3.jar:./lib/stringtemplate-3.2.1.jar'
>
>
> What is really bothering my is that the the code generated from
> Antlrworks (when I Debug the grammar) is OK
>
> public final void synpred9_CoreConfiguration_fragment() throws
> RecognitionException {
> Token value=null;
>
> If I can get some pointers about where to look/what to look for in the
> code generators (eg: template fragments) I might be able to get more
> info on the code that's playing up. It could be a bad JAR that's being
> retrieved by my build system (Apache Ivy).
>
> Cheers,
>
> On 23/07/64 5:59 AM, Ivan Brezina wrote:
>> Hi
>> maybe you're hitting already discovered bug. This was introduced in the
>> version 3.4. What does the output look like when you use ANTLR version
>> 3.3?
>>
>> Ivan
>>
>> Quoting Kieran Simpson <kierans777 at gmail.com>:
>>
>>> For my rule:
>>>
>>> rule
>>> : OPTION1
>>> | value=TION2 -> ($value)
>>> ;
>>>
>>> with backtracking on (and memoize not that I think that's relevant) the
>>> synpredicate code generated has errors, both for the Java and C targets
>>> where the variable name is missing in the declaration
>>>
>>> eg:
>>>
>>> public final void synpred9_grammar_fragment() throws
>>> RecognitionException {
>>> Token =ll;
>>>
>>> and
>>>
>>> static void synpred9_grammar_fragment(pCoreConfigurationParser ctx )
>>> {
>>> pANTLR3_COMMON_TOKEN ;
>>>
>>> =ULL;
>>>
>>> Interestingly this grammar runs in debug mode when used with Antlrworks
>>> even though I'm using version 3.4 of Antlr with my project and 3.4 is
>>> included with Antlrworks (1.4.3).
>>>
>>> Just in case it's due to an out of date version, here are some md5sums
>>>
>>> 9638f9b7b1b823fcaba977f06f0dd761 ./antlr/3.4/antlrworks-1.4.3.jar
>>>
>>> 465472089d78cd80f926f5825a29ec7f ./lib/antlr-3.4.jar
>>> 0e0318be407e51fdf7ba6777eabfdf73 ./lib/antlr-runtime-3.4.jar
>>>
>>> Is something out of date here or is this a bug with the backtracking
>>> generation?
>>>
>>> Cheers,
>>>
>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>> Unsubscribe:
>>> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>>>
>>
>>
>>
>> ----------------------------------------------------------------
>> This message was sent using IMP, the Internet Messaging Program.
>>
>>


More information about the antlr-interest mailing list