Add "if" support

This commit is contained in:
bʰedoh₂ swé 2024-06-11 05:14:22 +05:00
parent 07f9a6abd8
commit 4927054b60

View File

@ -245,6 +245,25 @@ char* compile(tSyntaxElement* syntaxtree) {
} else
if (strcmp(token->content.string, "if") == 0) {
compile_enter_tag(&result);
string_append(&result, "if ");
string_append(&result,compile_expression(token->next));
compile_exit_tag(&result);
string_append(&result,compile(token->next->next));
compile_enter_tag(&result);
string_append(&result, "endif");
compile_exit_tag(&result);
} else
if (strcmp(token->content.string, "print") == 0) {
string_append(&result, "{{");