#ifndef REPL_H #define REPL_H #include "memory_pool.h" #define REPL_LINE_BUFFER_SIZE 128 #define REPL_RESULT_BUFFER_SIZE 128 typedef enum { REPL_OK, REPL_ERROR, REPL_EXIT, } repl_status_t; typedef int (*get_byte_fn_t)(void); typedef const expression_t *(*read_fn_t)( memory_pool_t *pool, const char *input, int len); typedef int (*evaluate_fn_t)(const expression_t *expression); typedef void (*print_fn_t)(const char *output, int len); typedef struct { get_byte_fn_t get_byte; read_fn_t read; evaluate_fn_t evaluate; print_fn_t print; memory_pool_t pool; char line_buffer[REPL_LINE_BUFFER_SIZE]; char result_buffer[REPL_RESULT_BUFFER_SIZE]; } repl_t; void init_repl(repl_t *repl); void step_repl(repl_t *repl); void run_repl(repl_t *repl); #endif