I tried googling on how to do this but I couldn't find any tutorials or instructions on how to define an operator for a custom type. I'm not sure if it can be done or not, but I've defined operators before in scala and haskell, operators as in "+" and "==". If anyone can point me to instructions on how to do this with C I would appreciate it.
This is my custom typedef:
Code:
typedef enum token_types{
BEGIN, END, READ, WRITE, ID,
INTLITERAL, LPAREN, RPAREN,
SEMICOLON, COMMA, ASSIGNOP,
PLUSOP, MINUSOP, SCANEOF
} token;
I need to define a comparison operator for these tokens. I'm using this to create a small compiler.