Answer the question
In order to leave comments, you need to log in
From the point of view of C lexemes minus this?
From the point of view of C lexemes, are the minus signs in the first and second expressions different signs?
I break the C code into tokens and assign the minus sign to a lexeme called "operations".
1) int a = -1;
2) int a = 2-1;
Minus in both cases is it a separate lexeme? If so, how do you tell the resolver that -1 is an indivisible structure?
Answer the question
In order to leave comments, you need to log in
Minus in both cases is it a separate lexeme?
We'll have to teach the recognizer to perform operations on constants. Then both -1 and 2-1 will be compile-time constants, while (-x) and x-1 will be the result of various minus operations (which don't have to be related in any way).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question