1 entity step1_read_print is
2 end entity step1_read_print;
7 use WORK.pkg_readline.all;
12 architecture test of step1_read_print is
13 procedure mal_READ(str: in string; ast: out mal_val_ptr; err: out mal_val_ptr) is
15 read_str(str, ast, err);
16 end procedure mal_READ;
18 procedure EVAL(ast: inout mal_val_ptr; env: in string; result: out mal_val_ptr) is
23 procedure mal_PRINT(exp: inout mal_val_ptr; result: out line) is
25 pr_str(exp, true, result);
26 end procedure mal_PRINT;
28 procedure REP(str: in string; result: out line; err: out mal_val_ptr) is
29 variable ast, eval_res, read_err: mal_val_ptr;
31 mal_READ(str, ast, read_err);
32 if read_err /= null then
41 EVAL(ast, "", eval_res);
42 mal_PRINT(eval_res, result);
46 variable is_eof: boolean;
47 variable input_line, result: line;
48 variable err: mal_val_ptr;
51 mal_readline("user> ", is_eof, input_line);
53 next when input_line'length = 0;
54 REP(input_line.all, result, err);
56 pr_str(err, false, result);
57 result := new string'("Error: " & result.all);
59 if result /= null then
60 mal_printline(result.all);
70 end architecture test;