In bison you can access the starting and ending position of the current expression using the variable @$, which contains a struct with the members first_column, first_line, last_column and last_line. Similarly @1 etc. contain the same information for the sub-expressions $1 etc. respectively. In order to have access to the...
I would think you would get a shift/reduce conflict report for that grammar, although where that error message shows up might well depend on which tool BNFC is using to generate the parser. As far as I know, all the backend tools have the same approach to dealing with shift/reduce...
The line on which it fails, cannot be parsed because you are missing some rules : You need a rule for parsing qualified ids. A qualified id is a special type of identifier, and can (for your purposes) be used in the same situations as an (unqualified) identifier. std::cout and...