Clean up REPL formatting.

This commit is contained in:
Simon Forman
2019-08-11 17:00:38 -07:00
parent 4d33f32674
commit ab454375c0
2 changed files with 43 additions and 2 deletions
+6 -2
View File
@@ -22,12 +22,13 @@ Main Loop
:- initialization(loop).
loop :- line(Line), loop(Line, [], _Out).
loop :- prompt, line(Line), loop(Line, [], _Out).
loop([eof], S, S) :- !.
loop( Line, In, Out) :-
do_line(Line, In, S),
write(S), nl,
show_stack(S),
prompt,
line(NextLine), !,
loop(NextLine, S, Out).
@@ -35,3 +36,6 @@ loop( Line, In, Out) :-
do_line(Line, In, Out) :- phrase(joy_parse(E), Line), thun(E, In, Out).
do_line(_Line, S, S) :- write('Err'), nl.
prompt :- write(`joy? `).
show_stack(S) :- nl, print_stack(S), write(` <-top`), nl, nl.