1
0
Fork 0
This commit is contained in:
Alex Kotov 2023-05-04 03:16:19 +04:00
parent 417b109fda
commit c8b083d826
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 12 additions and 3 deletions

15
main.c
View File

@ -278,7 +278,7 @@ void expect(const enum TokenType token_type)
struct Object *parse()
{
return parens();
return expr();
}
struct Object *expr()
@ -337,8 +337,17 @@ struct Object *parens_part()
struct Object *eval(struct Object *const program)
{
if (program->type != TYPE_PAIR) {
error("eval expects pair");
if (!program) {
error("can't eval null");
return NULL;
}
if (program->type != TYPE_PAIR && program->type != TYPE_ATOM) {
return program;
}
if (program->type == TYPE_ATOM) {
error("can't eval atoms");
return NULL;
}