implements PDA. not create tree yet.