add if and else, and fix nested loops (hopefully)

This commit is contained in:
r4
2021-12-23 19:58:00 +01:00
parent ef63742015
commit 97e8e32ebc
6 changed files with 87 additions and 14 deletions

2
lex.c
View File

@@ -54,6 +54,8 @@ TokList lex(const char *s) {
}
if (streq_0_n("if", start, i))
emit(&toks, &pos, (Tok){ .kind = TokIf });
else if (streq_0_n("else", start, i))
emit(&toks, &pos, (Tok){ .kind = TokElse });
else if (streq_0_n("while", start, i))
emit(&toks, &pos, (Tok){ .kind = TokWhile });
else {