diff options
Diffstat (limited to 'repl.pl')
-rw-r--r-- | repl.pl | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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', |