From 2a232f8f42c0a7d5a7b648358a192c21865a55f6 Mon Sep 17 00:00:00 2001 From: Kai Stevenson Date: Sat, 10 Jun 2023 23:45:25 -0700 Subject: lexing works --- lexer.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 lexer.h (limited to 'lexer.h') diff --git a/lexer.h b/lexer.h new file mode 100644 index 0000000..f8dc046 --- /dev/null +++ b/lexer.h @@ -0,0 +1,39 @@ +#ifndef LEXER +#define LEXER +typedef enum TokenType { + ERR, + EOL, + STRING, + INT, + OPEN_PAREN, + CLOSE_PAREN, + START_COMMENT, + JUSTIFICATION, + PREMISE, + ASSUMPTION, + CONJUNCTION, + DISJUNCTION, + IMPLICATION, + BI_IMPLICATION, + EXPLOSION, + ELIMINATION, + INTRODUCTION, +} tokenType_t; + +typedef struct Token { + tokenType_t type; + void* value; +} token_t; +token_t init_token(tokenType_t type, void* value); +typedef struct LinkedList { + void* value; + struct LinkedList* next; +} linkList_t; + +linkList_t* init_linklist(void* value, linkList_t* next); +int advance_whitespace(char** linePointer); +linkList_t* lex_line(char* line); +token_t lex_first_token(char** content); +token_t lex_first_string(char** content); +token_t lex_first_int(char** content); +#endif -- cgit v1.3.1