How C/C++ tokeniser/parser doesn't misunderstand the usage of '*', since it can be used for multiplication and for pointers type. eg:.
... {
...
obj *var1; // * used to make var1 as pointer to obj
var1 * var2; // * used to multiply var1 and var2
}
Update 1: While tokenising/parsing, we can't yet make difference between identifier that refers to a variable and identifier that refers to a type.
Update 2: (Context of question) I'm designing and implementing a programming language of C/C++ family, where pointers are declared like Pointer<int>
, and I want to use C-pointer style instead.
Update 3 (on Dec 30, 2016): Some answers of this stackoverflow question about LR(1) parser and C++ seem to treat my question.