I have to define the grammar of a file like the one shown below.
//Sample file
NameCount = 4
Name = a
Name = b
Name = c
Name = d
//End of file
Now I am able to define tokens for NameCount and Name. But i have to define the file structure including the valid number of instances of token Name , which is the value after NameCount. I have the value parsed and converted into an integer and stored in a variable at global scope of the grammar (say in variable nc).
How to define in grammar that Name should repeat exactly nc times?