So, I am doing a lexical analysis of a TOY programming language using flex. I am currently stuck at the following point.
Minus sign: As we know the minus sign can have two meanings by defining them as binary or unary operators (I also know you can discard two meanings and just say that -2 is the same as 0-2). Firstly, I have only studied lexical analyzers as of now and I don't know anything about parsers. So, should I care about distinguishing these two minus signs, becomes sometimes the analyzer will print -2 as a Numeric literal and sometimes - as an operator and 2 as a numeric literal? Or can this kind of clubbing of two literals be done during parsing? If yes, then should I only define positive numbers and - as a unary operator?