-
Notifications
You must be signed in to change notification settings - Fork 1
/
stmt.h
40 lines (32 loc) · 824 Bytes
/
stmt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef STMT_H
#define STMT_H
#include "decl.h"
#include "expr.h"
#include "param_list.h"
extern int TYPE_ERROR;
typedef enum {
STMT_DECL,
STMT_EXPR,
STMT_IF_ELSE,
STMT_FOR,
STMT_PRINT,
STMT_RETURN,
STMT_BLOCK
} stmt_t;
struct stmt {
stmt_t kind;
struct decl *decl;
struct expr *init_expr;
struct expr *expr;
struct expr *next_expr;
struct stmt *body;
struct stmt *else_body;
struct stmt *next;
};
struct stmt * stmt_create( stmt_t kind, struct decl *decl, struct expr *init_expr, struct expr *expr, struct expr *next_expr, struct stmt *body, struct stmt *else_body, struct stmt *next );
void stmt_print( struct stmt *s, int indent );
void tab_print(int ident);
void stmt_resolve( struct stmt *s, struct hash_table *h);
void stmt_typecheck( struct stmt *s);
void stmt_delete( struct stmt *s );
#endif