Cannot print correct values in Bison code

"M. P. D Productions" <[email protected]>
Newsgroups gmane.comp.parsers.bison.general
Message-ID <CAH-_mJmBjj8mq3752h=qNLraY0Bs7ag=kh0Nkg_S=FVoBSUBdQ@mail.gmail.com>
*BISON VERSION: 3.6.2*

Hey! I'm very new to Flex/Bison, so please go easy on me. I am trying to
declare the syntax of an "array" as follows:
*array: '[' array_vals ']'*

*array_vals:*
*| vals*

*vals: STRING //String values defined in my lexer*
*| FLOAT //Float values defined in my lexer*
*| INT //Integer values defined in my lexer*

I feel like this is pretty self explanatory, but there's just *one *problem:
Wherever I print the "array_vals", using this:  *array: '[' array_vals ']'
{ cout << $2 << endl; }* I get only the first value of the array in my
source code, so if I have this in my source file: "[10, 20, 30, 40]" then
it only prints "10." I've tried printing the "vals" in "array_vals", and
it's even weirder and inconsistent. I know that this isn't a bug since I
went from Bison version 3.5.1 to 3.6.2 and there was no difference. If
someone knows, then thank you, but once again, I am new to this, so please
go easy on me.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.