And I related question:
Does the previous answer mean that there can only be one way to define lists of a specific symbol in a grammar if using the syntax [C] to represent them?
And what I mean by that is that, at the type level, you may want, for example, lists of C's separated by commas and lists of C's separated by semicolons to all be lists. But at grammar/production level, they are different symbols. For example, if you first define:
B. B ::= [C];
separator "," C;
Then you cannot define A to be lists of C's separated by semicolons using the same syntax, because [C] would have two different meanings in this grammar:
A. A -> [C];
-- I'd like to write now: separator ";" C;
I give them different names either, and then use [] and (:) to build lists in both cases. For example, the following would be illegal, right?
([]) . B ::= C;
(:) . B ::= B "," C;
([]) . A ::= C;
(:) . A ::= A ";" C;
Because I cannot use the constructors [] and (:) in those rules.
Am I wrong about any of this? What is the approach to follow in this case?
Thanks,
Ivan