summaryrefslogtreecommitdiff
path: root/repl.pl
diff options
context:
space:
mode:
Diffstat (limited to 'repl.pl')
-rw-r--r--repl.pl13
1 files changed, 12 insertions, 1 deletions
diff --git a/repl.pl b/repl.pl
index 1a2087a..a936535 100644
--- a/repl.pl
+++ b/repl.pl
@@ -1,13 +1,24 @@
:- module(repl, []).
-repl(Args) :-
+repl([ProgName|Args]) :-
write('Welcome to p-prolog version 1'),
nl,
write('Started with args: '),
write(Args),
nl,
+ handle_args(Args),
repl_loop.
+handle_arg('-d') :-
+ set_prolog_flag(debug, on).
+handle_arg(Arg) :-
+ write('Unhandled command line argument: '),
+ writeq(Arg),
+ nl.
+
+handle_args([Arg|Rest]) :- handle_arg(Arg), !, handle_args(Rest).
+handle_args([]).
+
repl_loop :-
catch(read_eval_print, E, print_exception(E)),
'$collect_garbage',