Preferring a lexer that doesn't expose state to the parser: a) lexer emits TK_GT for "normal" '>' b) lexer emits two tokens for '>>': TK_GT1 TK_GT2 c) in non-template area of grammar, use non-terminal to refer to '>>' operator: rshift : TK_GT1 TK_GT2 d) in template area of grammar, use non-terminal to refer to '>': rangle : TK_GT1 | TK_GT2 | TK_GT
On Wed, Feb 6, 2013 at 9:03 AM, Hans Aberg <haber...@telia.com> wrote: > On 6 Feb 2013, at 11:32, John P. Hartmann <jphartm...@gmail.com> wrote: > > > Isn't the point that <> are brackets (parentheses) in this context. > > Clearly the lexer must determine this and emit an appropriate token. > > The ">>" token is context dependent, so the parser might set that context > in a variable which the lexer reads, and if it is set, emits two ">" in two > successive calls. > > > > On 6 February 2013 10:14, Hans Aberg <haber...@telia.com> wrote: > >> On 6 Feb 2013, at 00:54, Adam Smalin <acidzombi...@gmail.com> wrote: > >> > >>> This doesn't help :( I see >> is in the lexer (search SHL) which means > List<List<int>> will not compile because >> is a right shift. But i looked > in the y file first and well... like i said its a C++ problem so C++ > obviously would suffer from it. > >> > >> Have you tried the other way around: sorting out ">>" in the actions? > But otherwise, there might be somebody out there already having solved this. > >> > >>> On Mon, Jan 28, 2013 at 6:16 PM, Hans Aberg <haber...@telia.com> > wrote: > >>> On 15 Jan 2013, at 03:48, Adam Smalin <acidzombi...@gmail.com> wrote: > >>> > >>>> As we know in C++ there is a issue... > >>> > >>> > >>> You might inquiry in the Usenet newsgroup comp.compilers. There is a > Yaccable C++ grammar for an older revision, it may not have been updated. > >>> http://www.parashift.com/c++-faq-lite/yaccable-grammar.html > >>> > >>> Hans > > > _______________________________________________ > help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison > _______________________________________________ help-bison@gnu.org https://lists.gnu.org/mailman/listinfo/help-bison