Yacc returns only one node at a time, and this is always what you just gave yacc at an earlier time, that is, whatever you would like to return from shortened production or that you would like to return a character from the terminal. (Sorry, you said you knew this, but some people reading this may not do this.)
So, take what you returned from the root or top rule, and save it (in the attached abbreviation C) in whatever way you like.
source
share