core: Add lexer + parser groundwork

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-05-23 02:21:09 -04:00
parent 659dd38932
commit 74e2e8c772
6 changed files with 232 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2026, Chloe M.
* Provided under the BSD-3 clause
*/
#ifndef CESCAL_TOKEN_H
#define CESCAL_TOKEN_H 1
/*
* Represents valid source file token types
*/
typedef enum {
TT_NONE, /* [none] */
TT_IDENT, /* [identifier] */
TT_INTLIT, /* [0-9]+ */
TT_LPAREN, /* '(' */
TT_RPAREN, /* '( */
TT_COMMA, /* ',' */
TT_RETURN, /* 'return' */
TT_PUB, /* 'pub' */
TT_PROC, /* 'proc' */
TT_BEGIN, /* 'begin' */
TT_END, /* 'end' */
} tt_t;
/*
* Represents a source file token
*
* @type: Token type
*/
struct token {
tt_t type;
union {
char c;
};
};
#endif /* !CESCAL_TOKEN_H */