26 lines
380 B
C
26 lines
380 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
#include "evaluator.h"
|
|
#include "reader.h"
|
|
#include "repl.h"
|
|
|
|
static void print(const char *output, int len)
|
|
{
|
|
fwrite(output, 1, len, stdout);
|
|
}
|
|
|
|
static repl_t repl = {
|
|
.get_byte = getchar,
|
|
.read = read_expression,
|
|
.evaluate = evaluate,
|
|
.print = print,
|
|
};
|
|
|
|
int main(void)
|
|
{
|
|
init_repl(&repl);
|
|
run_repl(&repl);
|
|
return EXIT_SUCCESS;
|
|
}
|