Re: 10206 lexical ambiguity
Paul Isaacs <[email protected]> Thu, 19 Jan 2017 15:54:50 -0500
| Newsgroups | gmane.comp.compilers.gpc |
|---|---|
| Message-ID | <[email protected]> |
On 19/01/17 01:57 PM, Bastiaan Veelo wrote: >> On 19 Jan 2017, at 19:48, Paul Isaacs <[email protected]> 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 [email protected] https://www.g-n-u.de/mailman/listinfo/gpc