[antlr-interest] Re: woohoo! ParseTrees for free, Debugging f or me!

Terence Parr parrt at cs.usfca.edu
Tue Dec 2 10:22:11 PST 2003


On Tuesday, December 2, 2003, at 09:58 AM, mzukowski at yci.com wrote:
> Somewhere my point was going to be that changing your parser around to
> accommodate tree building will break your derivation and hence your 
> unit
> test.  So they need to be easy to fix.

Exactly what I want though.  I want to test ANTLR's parser generation.  
The same grammar should give the exact same derivation.  A change in 
the grammar should be a different test. :)

> However I'm looking forward to thrashing out a viable testing strategy 
> for
> parsers and translators.  For C, anyway, it's not been a problem to 
> have
> entire programs be the "unit" tested because they can still be small.

True, but I need lower-level testing every time I tweak subrule 
recognition, for example.

Should be fun building a test harness :)

Ter
>
> Monty
>
> -----Original Message-----
> From: Terence Parr [mailto:parrt at cs.usfca.edu]
> Sent: Tuesday, December 02, 2003 8:32 AM
> To: antlr-interest at yahoogroups.com
> Subject: Re: [antlr-interest] Re: woohoo! ParseTrees for free, 
> Debugging f
> or me!
>
>
> On Tuesday, December 2, 2003, at 07:01  AM, mzukowski at yci.com wrote:
>
>> This is really cool!  Any chance of getting the actual tokens matched
>> by the
>> rule in that derivation?  That's the other thing I look at when using
>> -traceParser.
>
> Sure...I'll combine with my TokenStreamTracker (next little goodie to
> release, which is an extension / simplification of the "preserving
> token order with trees" article).
>
>> As for a test harness--yeah, that's cool for just doing parsers, but 
>> my
>> preferred approach, a la the GCC toolkit
>> http://www.codetransform.com/gcc.html, is to go from source to source
>> and
>> then make sure you've got the same thing (minus some whitespace).
>
> That is more functional that unit testing...unit testing in *addition*
> could be good so we can more precisely identify where the problem is.
> The functional testing would test more of the translation rather than
> the parsing....good to have both. :)
>
> Ter
>
>>
>> Monty
>>
>> -----Original Message-----
>> From: Terence Parr [mailto:parrt at cs.usfca.edu]
>> Sent: Sunday, November 30, 2003 10:07 AM
>> To: antlr-interest at yahoogroups.com
>> Subject: Re: [antlr-interest] Re: woohoo! ParseTrees for free,
>> Debugging for
>> me!
>>
>>
>>
>> On Sunday, November 30, 2003, at 12:16  AM, lgcraymer wrote:
>>
>>> --- In antlr-interest at yahoogroups.com, Terence Parr <parrt at c...>
>>> wrote:
>>>>
>>>> On Saturday, November 29, 2003, at 10:16  PM, lgcraymer wrote:
>>>>
>>>>> Ter--
>>>>>
>>>>> If I interpret this right, you're actually visualizing parse
>>> trees
>>>>> without generating them.
>>>>
>>>> Nope, i build parse trees and then rewalk them to get step i of
>>>> derivation.  You can ask for any intermediate step or all of 'em :)
>>>
>>> That is impressive, then--you've discovered a whole new approach to
>>> instrumenting ANTLR.  I assume that you've made the overrides user
>>> programmable?
>>
>> Well, for now it's just an "article" on the website with some sample
>> code...later we'd have to allow people to specify their own parse tree
>> nodes instead of my simple ones...  As for user programmable, for now,
>> you can turn on or off by adding the overrides and turning on/off
>> -traceParser.
>>
>>>   It sounds like an approach that might support an
>>> ANTLR test harness for grammars.
>>
>> Heh yeah!  That's a great idea, dude!  Sweet!  This way we can check 
>> to
>> see if all derivation steps are identical.  Previously, testing 
>> parsers
>> was really hard as it says yes or no depending on errors; that's all.
>>   Answering "yes" is not much of a test as an empty main program gives
>> the same answer. ;)  Yeah!  This is the testing harness I've been
>> afraid would be extremely difficult!  We've got it, by jove!
>>
>>
>>
>> Your use of Yahoo! Groups is subject to
>> http://docs.yahoo.com/info/terms/
>>
>>
>>
> --
> Professor Comp. Sci., University of San Francisco
> Creator, ANTLR Parser Generator, http://www.antlr.org
> Co-founder, http://www.jguru.com
> Co-founder, http://www.knowspam.net enjoy email again!
> Co-founder, http://www.peerscope.com link sharing, pure-n-simple
>
>
>
>
>
>
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
>
>
>
>
> Your use of Yahoo! Groups is subject to 
> http://docs.yahoo.com/info/terms/
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com pure link sharing




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list