jeudi 7 juin 2018

How C++ compilers differentiate the token >> for binary operator, and for template

My doubt is about the parser of C++ compilers as Clang, how the compilers handle the operator >> to know when it is a binary operator and when it is closing a template like: std::vector<std::tuple<int, double>>, I imagine that is done in parser time, so the better way to solve that is on lexical or use only > as token, and solve the problem in the grammar parser?

Aucun commentaire:

Enregistrer un commentaire