In order to handle the grammar rule:
type : ARRAY '[' integer_constant RANGE integer_constant ']' OF stype { $$ = $8 }
| stype { $$ = $1 }
;
I need to pass up the type attribute (as I'm doing now) but I also need to pass up the range of the array in order to check array bounds. I've tried all kinds of ways to use a struct in order to achieve something like:
type : ARRAY '[' integer_constant RANGE integer_constant ']' OF stype { $$.type = $8; $$.range[0] = $3; $$.range[1] = $5; }
| stype { $$.type = $1 }
;
But everything leads to errors and segfaults and I'm having a tough time finding the correct way to handle this
Can anyone point me in the right direction? Thanks in advance.
parse.y: http://pastebin.com/XUUqG35s