changed to iterators in ast generator