summaryrefslogtreecommitdiff
path: root/prolog
AgeCommit message (Collapse)Author
2015-08-11Reorder functions in PrologEngineTimotej Lazar
Place functions for internal use at the end.
2015-08-11Use abolish/1 instead of erase/1 to remove clausesTimotej Lazar
Using erase/1 keeps the dynamic property for all defined predicates in the testing module. This overrides the clauses in solution modules. For example, if the user defines conc/3 in the solution for the dup/2 problem, the correct conc/3 would not get used even after unloading all user's clauses. This commit also plugs a couple of memory leaks by opening (and later discarding) a new Prolog frame in functions test, load_solution and mark_solved.
2015-08-11Improve handling of Prolog exceptionsTimotej Lazar
2015-08-11PrologEngine: disable autoloadTimotej Lazar
Turns out unix:dup/2 exists and is autoloaded if the student solution for dup/2 does not contain the predicate with this name; this can mess up subsequent tests.
2015-08-11Load prolog/lib.pl during PrologEngine initTimotej Lazar
This is always required for the safe_goal/1 predicate.
2015-08-11Add a test to prolog.engine and clean up a bitTimotej Lazar
2015-08-11Remember correct answers to test queriesTimotej Lazar
2015-08-11Start refactoring testing codeTimotej Lazar
Testing logic now lives in PrologEngine. The engine now has some notion of problems and users, which is necessary to avoid repeatedly loading code into Prolog. TODO: - support library loading - fix PrologEngine.test for unusual cases (more than one solution, …) - memoization of correct answers
2015-08-11Mark random and random_between as safe goalsTimotej Lazar
Required for exercise 25 (genlist).
2015-08-11Keep token positions when lexingTimotej Lazar
This will allow us to match line edits to original source locations.
2015-08-11Simplify prolog.util.map_varsTimotej Lazar
Return a single mapping instead of generating all possible permutations. Only the first solution was used anyway, with little effect on found solutions.
2015-08-11Add some ad-hoc test code to prolog/util.pyTimotej Lazar
2015-08-11Rework prolog query engineTimotej Lazar
Use exceptions to report errors. Used in the server branch.
2015-08-11Clean up prolog.engineTimotej Lazar
Use findnsols/4 to allow limiting the number of solutions found by prolog.engine.query. Add a basic test case to prolog.engine.
2015-08-11Add PL_clear_exception to prolog/core.pyTimotej Lazar
2015-08-11mv prolog/sandbox.pl prolog/lib.plTimotej Lazar
2015-08-11Cleanups in monkey.pyTimotej Lazar
2015-08-11Lexer: increase priority for t_commentTimotej Lazar
Multiline comments were not lexed correctly because /* was interpreted as an operator.
2015-08-11Move PQueue and utility functions into util.pyTimotej Lazar
2015-08-11Use immutable values in queueTimotej Lazar
2015-08-11Remove unnecessary check from prolog.util.composeTimotej Lazar
2015-08-11Fix two bugs in prolog.util.decomposeTimotej Lazar
2015-08-11Add call(predicate, arguments) to PrologEngineTimotej Lazar
Also disable error messages printed by swipl library.
2015-08-11Optimize prolog.util.stringify (~15% faster)Timotej Lazar
2015-08-11Improve testing procedureTimotej Lazar
- only run queries with correct code once - use msort/2 to implement quicksort/3, used for some tests - correctly split programs in the presence of =.. operator
2015-08-11CleanupsTimotej Lazar
2015-08-11Some cleanups in main programTimotej Lazar
2015-08-11Initial commit for pymonkeyTimotej Lazar