I'm playing with bison and flex to understand the way how interpreters work. I've already done several things like range ({INT:INT}
or {INT:INT:INT}
), strings ({string"here comes any text"}), etc., but I can't decide which should be right way to help bison understand if user entered array in form [INT, INT, ID, ID, INT, ..., INT, ID, ID...]
?
The first what comes in mind is to use flex keyword BEGIN
and then look till the end of line, but that seems to stupid since you need a lot of stuff like to understand if next member is INT or ID, and it is not such good way. What can I do else? I'd rather prefer to do it with bison, but I don't know how to make bison look recursive between [
and ]
to grab all what they contain. How can I do it?
Thanks in advance!