minic: C23 doesn't allow bool as identifier

Signed-off-by: Horst H. von Brand <vonbrand@inf.utfsm.cl>
This commit is contained in:
Horst H. von Brand 2025-03-14 12:12:32 -03:00 committed by Quentin Carbonneaux
parent 903610de4f
commit 348f2eac90

View File

@ -70,7 +70,7 @@ struct Stmt {
int yylex(void), yyerror(char *); int yylex(void), yyerror(char *);
Symb expr(Node *), lval(Node *); Symb expr(Node *), lval(Node *);
void bool(Node *, int, int); void branch(Node *, int, int);
FILE *of; FILE *of;
int line; int line;
@ -329,7 +329,7 @@ expr(Node *n)
case 'a': case 'a':
l = lbl; l = lbl;
lbl += 3; lbl += 3;
bool(n, l, l+1); branch(n, l, l+1);
fprintf(of, "@l%d\n", l); fprintf(of, "@l%d\n", l);
fprintf(of, "\tjmp @l%d\n", l+2); fprintf(of, "\tjmp @l%d\n", l+2);
fprintf(of, "@l%d\n", l+1); fprintf(of, "@l%d\n", l+1);
@ -468,7 +468,7 @@ lval(Node *n)
} }
void void
bool(Node *n, int lt, int lf) branch(Node *n, int lt, int lf)
{ {
Symb s; Symb s;
int l; int l;
@ -483,16 +483,16 @@ bool(Node *n, int lt, int lf)
case 'o': case 'o':
l = lbl; l = lbl;
lbl += 1; lbl += 1;
bool(n->l, lt, l); branch(n->l, lt, l);
fprintf(of, "@l%d\n", l); fprintf(of, "@l%d\n", l);
bool(n->r, lt, lf); branch(n->r, lt, lf);
break; break;
case 'a': case 'a':
l = lbl; l = lbl;
lbl += 1; lbl += 1;
bool(n->l, l, lf); branch(n->l, l, lf);
fprintf(of, "@l%d\n", l); fprintf(of, "@l%d\n", l);
bool(n->r, lt, lf); branch(n->r, lt, lf);
break; break;
} }
} }
@ -526,7 +526,7 @@ stmt(Stmt *s, int b)
case If: case If:
l = lbl; l = lbl;
lbl += 3; lbl += 3;
bool(s->p1, l, l+1); branch(s->p1, l, l+1);
fprintf(of, "@l%d\n", l); fprintf(of, "@l%d\n", l);
if (!(r=stmt(s->p2, b))) if (!(r=stmt(s->p2, b)))
if (s->p3) if (s->p3)
@ -540,7 +540,7 @@ stmt(Stmt *s, int b)
l = lbl; l = lbl;
lbl += 3; lbl += 3;
fprintf(of, "@l%d\n", l); fprintf(of, "@l%d\n", l);
bool(s->p1, l+1, l+2); branch(s->p1, l+1, l+2);
fprintf(of, "@l%d\n", l+1); fprintf(of, "@l%d\n", l+1);
if (!stmt(s->p2, l+2)) if (!stmt(s->p2, l+2))
fprintf(of, "\tjmp @l%d\n", l); fprintf(of, "\tjmp @l%d\n", l);