[antlr-interest] Backtracking and labels

Kieran Simpson kierans777 at gmail.com
Sun Mar 11 20:04:08 PDT 2012


Bisecting my way through the repo and testing out revisions, I think 
I've found the likely culprits for the regression between antlr-3.3 and 
3.4 (note I use hg-git)

changeset:   101:56ba79288764
user:        parrt <parrt at antlr.org>
date:        Sat May 14 10:24:19 2011 -0800
summary:     last few tweaks to get ST v4 working in C target for Jim.

changeset:   100:59fe389808a0
user:        parrt <parrt at antlr.org>
date:        Sat May 14 09:56:06 2011 -0800
summary:     update for Jim to ST v4

However due to compiler errors I couldn't check the following revisions:

45ca2453b2df,67678b99acdd,d844128119aa,d1e6eb1c7bf1,ae6a4ca2ab71,1c33e8e60e21,6a6179c5869b,8e997cdac2c5,42462909b4fc,bf6d0ad84fd1,75e932a346bd,1cf0ffe4556c,a38989618e4f,4c656baccc86,5b557aea2388,638689ca7b4f,a0ce90ec3883,6a2604dbf08e,6a926e780f1e,bb1ff003f2a7,55e6041441c2,4d85a9697a48,77427ba1f168,a7c6103ea0c8,83e1a246387c,574f8b31a801,5eabd9721dc2,723ea56bcf5f,89489f506789,b5b9b755e40c,6574451570c8,945a012a7dcd,f56685c7eec2,5e37281e3cfe,793f3298fc12,514cd2be224f,65528271faa9,63ff9c29cb79,881d10a9449a,703e16989010,248dcb9970ea,83f74245581e,93fca748c628,40d4c8456090,c4300f0234d3,51aa7ae9b2b4,7ff58e224342,ad0d6f1cf164,3b0de8add5ef,efa19fdf4e0e,07143dfc0063,b0b29474e6f5,32ea0d3d0338,32a1d9b9d45a,c8cb30ba8aaf,3de5ce7243c5,9dc88f30aec7,c71b9144232f,f76b9ac7fd0c,0fc00798d47d,311aa7bb6c53,a5a76dac6a16,cc31348b1cb7,bdd70fc3f278,e529f9f8c657,2aba07893d6a,cc612b5397f4,7d7933d47e98,abc1f7ae2b96,c77e39076745,5333bbfc20f3,7f0cb49b65e0,a0f8850b1330,5e33175e303e,d89d7a4ca7de,2b6a50012255,17
76c7013ef4,3fa1ea63b51b,157c1f0edb2b,272b22513c4e,03e2109db224,cecdc8a49296,edc3c300bb82,3be166dd09af,a0f73246ca67,597aae907a92,113810e45a7d,bb7773632377,a4eedebbe75f,52a8ebe321a4,99db69048e41,59fe389808a0,56ba79288764

HTH.

Cheers,

On 23/07/64 5:59 AM, Kieran Simpson wrote:
> 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