Clean up REPL formatting.
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user