From 967be9e750221ab2ab783f95df79bb26d290a45e Mon Sep 17 00:00:00 2001 From: Martial Simon Date: Mon, 15 Sep 2025 01:07:58 +0200 Subject: add: added projects --- 21sh/ll-expr/src/lexer/token.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 21sh/ll-expr/src/lexer/token.h (limited to '21sh/ll-expr/src/lexer/token.h') diff --git a/21sh/ll-expr/src/lexer/token.h b/21sh/ll-expr/src/lexer/token.h new file mode 100644 index 0000000..b0866fc --- /dev/null +++ b/21sh/ll-expr/src/lexer/token.h @@ -0,0 +1,25 @@ +#ifndef TOKEN_H +#define TOKEN_H + +#include + +enum token_type +{ + TOKEN_PLUS, // '+' + TOKEN_MINUS, // '-' + TOKEN_MUL, // '*' + TOKEN_DIV, // '/' + TOKEN_NUMBER, // "[0-9]+" + TOKEN_LEFT_PAR, // '(' + TOKEN_RIGHT_PAR, // ')' + TOKEN_EOF, // end of input marker + TOKEN_ERROR // it is not a real token, it is returned in case of invalid + // input +}; + +struct token +{ + enum token_type type; // The kind of token + ssize_t value; // If the token is a number, its value +}; +#endif /* !TOKEN_H */ -- cgit v1.2.3