Parse ints; move line/{1,2} to main.pl.

This commit is contained in:
Simon Forman
2019-08-13 11:29:49 -07:00
parent 3f19b2b210
commit defedcbd12
2 changed files with 11 additions and 10 deletions
+10
View File
@@ -41,3 +41,13 @@ do_line(_Line, S, S) :- write('Err'), nl.
prompt :- write(`joy? `).
show_stack(S) :- nl, print_stack(S), write(` <-top`), nl, nl.
% Line is the next new-line delimited line from standard input stream as
% a list of character codes.
line(Line) :- get_code(X), line(X, Line).
line(10, []) :- !. % break on new-lines.
line(-1, [eof]) :- !. % break on EOF
line(X, [X|Line]) :- get_code(Y), !, line(Y, Line).