aboutsummaryrefslogtreecommitdiff
path: root/matlab/step0_repl.m
blob: 3b4e7ca36b876f686c7bd166e9106e484cf5bde3 (plain)
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
function step0_repl(varargin), main(varargin), end

% read
function ret = READ(str)
    ret = str;
end

% eval
function ret = EVAL(ast, env)
    ret = ast;
end

% print
function ret = PRINT(ast)
    ret = ast;
end

% REPL
function ret = rep(str, env)
    ret = PRINT(EVAL(READ(str), env));
end

function main(args)
    while (true)
        line = input('user> ', 's');
        fprintf('%s\n', rep(line, ''));
    end
end