readline, calculate avgdepth per ast node