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

mzukowski at yci.com mzukowski at yci.com
Tue Dec 2 09:58:37 PST 2003


Yeah, I guess it depends on what your "unit" is.  Rules aren't really
methods, they're too interdependent, so a rule test just doesn't fly.  But
if you want to say your unit is a parser, then, OK I buy that.  My unit is a
"feature" like typedef or nested conditionals.  Boy this is a bogus
argument.  Never mind.

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.

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.  

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/ 




More information about the antlr-interest mailing list