summaryrefslogtreecommitdiff
path: root/prolog/engine.py
AgeCommit message (Collapse)Author
2015-08-27Replace prolog.engine.run with ask_allTimotej Lazar
Creating and destroying the pengine should be handled somewhere else. This commit also removes query functionality from prolog.engine.create.
2015-08-27Fix a typo and add a commentTimotej Lazar
2015-08-26Use /destroy_all to abort and destroy penginesTimotej Lazar
Poorly documented, but works better than abort & destroy.
2015-08-21Add a hashbang line to the Prolog server scriptTimotej Lazar
2015-08-20Add prolog.engine.runTimotej Lazar
Collects all the answers to a given query within the specified timeout.
2015-08-20Simplify and privatize prolog.engine.get_messageTimotej Lazar
2015-08-20Add a timeout option for prolog.engine requestsTimotej Lazar
2015-08-20Replace strip_html function in prolog.engineTimotej Lazar
2015-08-11Print 'true' on success with no bindingsTimotej Lazar
2015-08-11Improve error & warning reportingTimotej Lazar
Hope it does not break anything.
2015-08-11Use json-html format for Prolog repliesTimotej Lazar
The only way to get residuals in CLP queries.
2015-08-11Merge prolog.engine.create{,_and_ask} functionsTimotej Lazar
2015-08-11Remove app-specific code from prolog.engineTimotej Lazar
2015-08-11Specify timeout when generating test casesTimotej Lazar
2015-08-11Print a random failing test for incorrect solutionTimotej Lazar
2015-08-11prolog.engine: use .get() to access replyTimotej Lazar
In case SWI engine goes insane and returns a malformed reply (has happened). Also fix the test case in this file to use the new, classless methods.
2015-08-11Move monkey.prolog to root moduleTimotej Lazar
2015-08-11Move pymonkey stuff to monkey/Timotej Lazar
Importing pymonkey into webmonkey, let's see how this works.
2015-08-11Add prolog.engine.testTimotej Lazar
Depends on run_tests/3.
2015-08-11Improve error handling in PrologEngineTimotej Lazar
2015-08-11Delegate testing to a Prolog serverTimotej Lazar
... which obsoletes *a lot* of effort in making the testing procedure more robust in the past two years. Oh well. It seems to be the sanest way of coping with more than one simultaneous user (who could have predicted this use case?). The new way involves a PEngine server, and it seems to work quite well. Remember Knuth: premature optimization (as in ignoring possible solutions because they _might_ be to slow) is stupid. TODO: - library loading (again) - use of previous solution (again) - fix issues when converting non-ground terms to json Side note, constructivism works: in the past few days I have reached a much better but fundamentally ineffable intuition about Prolog, more so than in the past two years teaching it. So, fuck ITS and rather fix the schools by giving students something meaningful to do. Sigh.
2015-08-11PrologEngine: add load/unload functionsTimotej Lazar
2015-08-11Store test cases in PrologEngineTimotej Lazar
2015-08-11Add support for per-problem fact librariesTimotej Lazar
Each fact library is loaded at most once, so different problems can share the same library (e.g. family-relation problems).
2015-08-11Quote predicate name for abolish/1Timotej Lazar
2015-08-11Improve testing procedureTimotej Lazar
For each query: - generate a single solution - incorrect solution / timeout / other error → FAIL - generate (up to) ten solutions - more than one distinct solution found → FAIL - timeout is OK (a correct solution was found above) - if reached this point → PASS
2015-08-11Term.__iter__: create new Terms on each iterationTimotej Lazar
2015-08-11Mark solution predicates as static after loadingTimotej Lazar
This prevents incorrect student solutions from overwriting or adding to predicates in solution<n> modules.
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-11Keep token positions when lexingTimotej Lazar
This will allow us to match line edits to original source locations.
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-11Add call(predicate, arguments) to PrologEngineTimotej Lazar
Also disable error messages printed by swipl library.
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-11Initial commit for pymonkeyTimotej Lazar