Dump bison

Eric S. Raymond esr at thyrsus.com
Tue Jun 19 18:28:23 UTC 2018


Hal Murray <hmurray at megapathdsl.net>:
> 
> esr at thyrsus.com said:
> > What I think one needs for a test harness is the ability to dump the parse
> > tree structure in a textual form.  Changing parser generators won't give us
> > that. What really matters is whether our target language has introspection
> > capability and dynamic dump code. 
> 
> Is there a parse tree?  I thought the parser called out when it had enough 
> info to build a chunk of the tree.  I think that chunk is either a final leaf 
> node or one level up, a node with several parameters.

How deep the parse tree goes before a call-out varies depending on
what part of the configuration you're looking at.  You're right, there
isn't one big parse tree. I spoke loosely.

> My expectation is that we would write a collection of dummy called-out 
> routines that printed out the parameters rather than building ntpd's 
> equivalent of a chunk of the parse tree.

I thought about that back when I was looking at this code.  Concluded
it wouldn't be that useful to (effectively) just dump the input tokens
with a slightly different syntax.

If you think this was a mistake, I'm open to argument.

> >> When we ripped that stuff out, why didn't we add something better?
> > Because it wasn't actually used in the unit tests anywhere.  I concluded from
> > this that it was probably broken and nobody had had the round tuits to fix it
> > or remove it. So I removed it. 
> 
> There was a script that fed it a config file, wrote it out, and diffed them.  
> It wasn't integrated with either the test harness or with waf check, but it 
> worked.

I didn't know that.

Still, the fact that it wasn't integrated into the regular tests gives
me to doubt that the capability was actually useful.  And...It didn't *look*
like good code; it looked like an over-clever, over-elaborate hack.  That
kind of thing always makes my delete finger itchy.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.




More information about the devel mailing list