Language.Prolog.NanoProlog.Interpreter
Running the Interpreter
The main interpreter
The main
program prompt for a file with Prolog rules and call the main
interpreter loop
loop
ask for a goal, and enuartes all solutions found, each preceded by
a trace conatining the rules applied in a tree-like fashion
printSolutions :: Result -> IO ()Source
printSolutions
takes the result of a treewalk, which constructs
all the proofs, and pairs them with their final
substitutions. Alternative approaches in printing are to print the
raw proofs, i.e. without applying the final substitution (remove
the subst env
). This nicely shows how the intermediate variables
come into life. By including the test on the length the facts
directly stemming from the data base are not printed. This makes
the proofs much shorter, but a bit less complete.