On 19/01/17 20:54, Paul Isaacs wrote:
On 19/01/17 01:57 PM, Bastiaan Veelo wrote:
On 19 Jan 2017, at 19:48, Paul Isaacs paul@redpineinstruments.org wrote:
Hello,
Am I correct that, without semantic type tie-ins, that the production
new-ordinal-type = enumerated-type | subrange-type ;
is ambiguous because (a) could be both an enumerated type and the expression for the lower bound of a subrange?
Where do you see the ambiguity? enumerated-type is lexically different from subrange-type.
Bastiaan.
Hello Bastiaan,
x = (a); enumerated-type y = (a)..5 subrange-type where (a) is a subrange-bound, the subrange-bound production = expression and (a) is a lexically valid expression.
This would require a lookahead of 3 tokens to resolve. I believe the case is unique because "( a," can not
be an expression so must be an enumerated. This still requires a lookahead of 2 tokens to resolve.
The 10206 spec does not contain either lookahead or lalr so maybe requiring more than 1 token of lookahead is allowed.
Regards,
Paul
Gpc mailing list Gpc@gnu.de https://www.g-n-u.de/mailman/listinfo/gpc
Hi Paul,
As the grammer for new_ordinal_type is
new_ordinal_type: enumerated_type | subrange_type ;
(a) would still be parsed as "new_ordinal_type".
from that point, only one token, either ; or .. is needed to resolve which "new_ordinal_type" we have. Don't see the problem.
Regards, Peter