Skip to content

Commit 57fe612

Browse files
committedOct 12, 2021
Remove parser and codegen (for rewrite), upgrade the lexer to be uh better
1 parent 37260b7 commit 57fe612

14 files changed

+165
-148
lines changed
 

‎jas/jas

65.1 KB
Binary file not shown.
File renamed without changes.
File renamed without changes.

‎jcc/include/lexer.h

+13-14
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ enum LexTokenType {
99
TOK_INT,
1010
TOK_STR_LIT,
1111
TOK_IDENT,
12-
TOK_ADD,
13-
TOK_SUB,
14-
TOK_MUL,
15-
TOK_DIV,
16-
TOK_ASSIGN,
17-
TOK_COMPARE,
12+
TOK_PLUS,
13+
TOK_MINUS,
14+
TOK_STAR,
15+
TOK_SLASH,
16+
TOK_EQUALS,
17+
TOK_EQUALSEQUALS,
1818
TOK_GT,
1919
TOK_LT,
2020
TOK_GTE,
2121
TOK_LTE,
22-
TOK_ADD_ASSIGN,
23-
TOK_SUB_ASSIGN,
24-
TOK_MUL_ASSIGN,
25-
TOK_DIV_ASSIGN,
22+
TOK_PLUSEQUAL,
23+
TOK_MINUSEQUAL,
24+
TOK_STAREQUAL,
25+
TOK_SLASHEQUAL,
2626
TOK_OPAREN,
2727
TOK_CPAREN,
2828
TOK_OBRACE,
@@ -34,8 +34,9 @@ enum LexTokenType {
3434
TOK_ANDAND,
3535
TOK_OR,
3636
TOK_OROR,
37+
TOK_CARAT,
3738
TOK_MODULO,
38-
39+
3940
TOK_KINT,
4041
TOK_KCHAR,
4142
TOK_KSTRUCT,
@@ -54,9 +55,6 @@ enum LexTokenType {
5455
TOK_KBREAK,
5556
TOK_KCONTINUE,
5657
TOK_KTYPEDEF,
57-
58-
//TEMP
59-
TOK_KPRINT,
6058

6159
TOK_EOF,
6260
};
@@ -68,6 +66,7 @@ struct LexToken {
6866
size_t i;
6967
LexTokenType type;
7068
int linenum;
69+
char *whitespace;
7170
};
7271

7372
typedef struct LexToken LexToken;

‎jcc/jcc

59.7 KB
Binary file not shown.

‎jcc/src/parser.c ‎jcc/parser_old.c

File renamed without changes.
File renamed without changes.

‎jcc/src/lexer.c

+147-129
Large diffs are not rendered by default.

‎jcc/src/main.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
#include <jtools/reader.h>
55
#include "../include/lexer.h"
66
#include "../include/preprocessor.h"
7-
#include "../include/parser.h"
8-
#include "../include/codegen.h"
7+
//#include "../include/parser.h"
8+
//#include "../include/codegen.h"
99
#include "../include/args.h"
10-
#include "../include/symtable.h"
10+
//#include "../include/symtable.h"
1111

1212
int main(int argc, char **argv) {
1313
Args args = parse_args(argc, argv);
@@ -60,7 +60,7 @@ int main(int argc, char **argv) {
6060
printf("%s\n", src);
6161
free(src);
6262

63-
char *all_code = malloc(1024);
63+
/*char *all_code = malloc(1024);
6464
size_t code_len = 0;
6565
size_t code_cap = 1024;
6666
@@ -128,7 +128,7 @@ int main(int argc, char **argv) {
128128
fclose(fp);
129129
}
130130
131-
free(all_code);
131+
free(all_code);*/
132132
lex_free(&s);
133133
reader_free(&preproc_r);
134134
return 0;
File renamed without changes.
File renamed without changes.

‎jld/jld

34.5 KB
Binary file not shown.

‎jvm/jvm

35.8 KB
Binary file not shown.

‎libjtools/libjtools.a

1.73 KB
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.