summaryrefslogtreecommitdiff
path: root/prolog/util.py
AgeCommit message (Collapse)Author
2016-09-27Incorporate some tweaks to the monkey methodsTimotej Lazar
2016-05-16Detect predicates used in DCG clausesTimotej Lazar
2016-04-08Prolog: use A,B,C,… for normalized variable namesTimotej Lazar
This is somewhat more readable than A0,A1,A2,….
2016-04-08Remove unused prolog.util.normalizedTimotej Lazar
2016-04-07Always return a string in prolog.util.Token.__str__Timotej Lazar
2016-01-12Replace prolog.util.rename_vars with rename_vars_list everywhereTimotej Lazar
2016-01-04Add function to find predicates used by a Prolog programTimotej Lazar
2015-12-11Rename a functionTimotej Lazar
2015-12-11Use a more general method for extracting editsTimotej Lazar
This is a large overhaul of monkey code. Before, only edits within individual lines were tracked, which required a Prolog-specific method for splitting a program into a list of lines for every rule. In this version, modifications can be tracked within arbitrary code ranges. Ranges to be tracked are determined by selecting "interesting" subtrees in the AST of the starting code version. The new method is simpler, less language-dependent and easier to extend. The downside is that a program must be syntactically correct before we can attempt to fix it (the previous approach could handle programs with syntax errors in some cases). This commit also integrates a call to monkey.fix in prolog_session.hint, by running it if no other hint is found.
2015-12-10Support Tree objects in python.util.stringifyTimotej Lazar
2015-12-10Fix a parser bugTimotej Lazar
2015-12-10Add prolog.util.parse methodTimotej Lazar
2015-12-10Add copyright infoTimotej Lazar
2015-08-11Disable parser generationTimotej Lazar
The parser is currently unused.
2015-08-11Add a parser for (simplified) PrologTimotej Lazar
2015-08-11Remove unused function from prolog.utilTimotej Lazar
2015-08-11Annotate tokens instead of splitting programTimotej Lazar
Instead of splitting the program by line numbers, do limited parsing (enough to distinguish , in "memb(X,Y)" from , in "a :- b, c."). Each token in the parsed program is annotated with rule and part number. Rewrite monkey.fix.step to take program as a sequence of annotated tokens instead of lists of lines and rules. Improve message passing to website.
2015-08-11Simplify calls to prolog.util.map_varsTimotej Lazar
2015-08-11Move normalize to prolog.utilTimotej Lazar
2015-08-11Clean up prolog.util.decomposeTimotej Lazar
2015-08-11Remove all trailing punctuation from linesTimotej Lazar
Remove trailing sequences of COMMAs and PERIODs when extracting edits from a trace. This is because subgoal order is rarely important in Prolog, and we don't care if the edit happened on the last line or not. This means that we treat for example "conc(A,B)," → "conc(A,B,C)." the same as "conc(A,B)" → "conc(A,B,C)".
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-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-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-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-11Optimize prolog.util.stringify (~15% faster)Timotej Lazar
2015-08-11CleanupsTimotej Lazar
2015-08-11Some cleanups in main programTimotej Lazar
2015-08-11Initial commit for pymonkeyTimotej Lazar