37 lines
590 B
C
37 lines
590 B
C
#ifndef AM_H
|
|
#define AM_H
|
|
|
|
#include "expr.h"
|
|
#include "store.h"
|
|
|
|
#define AM_STACK_SIZE 128U
|
|
|
|
#define AM_ARGL(am) am->regs[ARGL]
|
|
#define AM_ENV(am) am->regs[ENV]
|
|
#define AM_EXPR(am) am->regs[EXPR]
|
|
#define AM_UNEV(am) am->regs[UNEV]
|
|
#define AM_VAL(am) am->regs[VAL]
|
|
|
|
typedef enum {
|
|
ARGL,
|
|
ENV,
|
|
EXPR,
|
|
UNEV,
|
|
VAL,
|
|
|
|
AM_REG_COUNT,
|
|
} am_reg_t;
|
|
|
|
typedef struct am {
|
|
expr_t *regs[AM_REG_COUNT];
|
|
expr_t **sp, *stack[AM_STACK_SIZE];
|
|
store_t store;
|
|
} am_t;
|
|
|
|
void am_init(am_t *am);
|
|
void am_push(am_t *am, am_reg_t reg);
|
|
void am_pop(am_t *am, am_reg_t reg);
|
|
void am_append_arg(am_t *am);
|
|
|
|
#endif
|