construct trees with token list