read from streams.

This commit is contained in:
Mark Thom
2019-04-13 18:40:17 -06:00
parent ed17867be0
commit ae90554378
25 changed files with 1657 additions and 1318 deletions

19
src/prolog/toplevel.pl Normal file
View File

@@ -0,0 +1,19 @@
repl :-
catch(read_and_match, E, '$print_exception'(E)),
false. %% this is for GC, until we get actual GC.
repl :- repl.
read_and_match :-
read_term(Term, [variable_names(VarList)]),
'$instruction_match'(Term, VarList).
'$instruction_match'([user], []) :-
!, '$compile_batch'.
'$instruction_match'(Term, VarList) :-
'$submit_query_and_print_results'(Term, VarList),
!.
'$print_exception'(E) :-
write_term('error: exception thrown: ', [quoted(false)]),
writeq(E),
nl.