How to pass comma separated values from yacc to cpp file node I am writing a compiler in CPP using Flex and Bison and having trouble understanding passing values up the syntax tree in bison.
I have grammar like this below,  'exp' would evaluate to any number.
args_list: exp | args_list comma exp; 
array_list: datatype identifier '[' number']' equal '{' args_list'}'{$$ = new array_node($1, $2, $4, $8);}

I wanted to pass args_list to the array_node but not getting how to pass? As you can see user can initialize array with any length but how to pass this list to CPP node?
for example - int a[4] = {1,2,3,4} ; I want to pass something like
new array_node(datatype, a, number, args_list) 

in which I am not getting how to pass args_list so that I can have array type.
Or please suggest me another way to pass the array list to the cpp file. or how to pass whole array to cpp file from yacc?
args_list’s type can be vector.
Then, instead of calling to new array_node you can have a factory method (array_node::factory) which parses the type, casts the args and returns the array_node object