Added `dict=` (name might changed) and aggregator which stores user variable
assignments. [This is what is used for answering queries like the one above.qq]
Parser now really should just be the parser.
OneshotDriver consumes an entire Dyna program at once, tracking
all the requisite state from line to line, before emitting the
whole mass to the down-stream pipeline.
While here, push through some changes for custom operator symbols, though
this is not quite wired up yet.
Change the world so that the planner generates OPEmit verbs rather
than emissions being magical bits of the backend. Expand the notion of an
emission to include the rule index (required for :=) and a set of variables
for hyper-edge identification. (Currently, we emit all of them, but later
we will want to trim this down to only nondeterministic variables.)
This change is the code-generator mate of timv's changes in 6abdc37.
Tim Vieira [Sat, 1 Jun 2013 03:21:49 +0000 (23:21 -0400)]
First-pass at a REPL
- user can add new rules (LIMITATIONS: no retracting rules; no queries yet.)
- new rules check for aggregator conflict.
- only shows the user what changed as a result of the new rule. rather than
dumping the entire chart. The chart isn't dumped every time we hit go().
Nicer chart pretty printing (only relevant to sets or lists of items), which is
only experimental.
Reverted Wes' changes to eval it seems like the change was not tested. Sorry Wes.
Nicer formatting for tracing messages. Tracing is no longer printed to
stderr. by defualt, it goes to /tmp/dyna.log (there is a cmdline option to
change that; there is also commands in the REPL "trace on" and "trace off").
Switch python selftests to run compiler themselves
And only run the interpreter as a captive process. This change is made with
the intent of more accurately reflecting code coverage when we start
tracking that within self-tests.
Notably, this marks the first commit to fix an externally filed bug report;
thanks to Abram Demski for reporting! Dyna should now build with ghc 7.4
and its Platform releases. :)
(This commit is a little bigger than just the fix as I had already changed
some of the code in my working tree and there seemed to be no reason not to
just commit things.)
Eliminate the awkward old ANF language in favor of direct translation to
Cruxes in Dyna.Analysis.ANF. Evaluation cruxes are now properly indexed
within rules using an Int, so we don't have to rely on the output variable
being unique. There are more flavors of unification cruxes, including
inequality constraints.
The terrible 'handleConflictors' has been replaced with a much more
sane function which operates on cruxes, rather than on DOpAMine, which will
be welcome when we have more interesting OPIter modes.
While here, move python scripts from bin/ to src/Dyna/Backend/Python and
adjust the world. Use this as an excuse to make ./debug invoke the dyna
compiler only once and dump everything to different files in $PROGRAM.d/
This brings the Mercury mode system all the way out through the planner,
though it does not actually really avail itself of any of the improved
functionality. It compiles and passes all selftests, but that, too, is
hardly saying anything.
The beginnings of a re-implementation of Mercury's mode system, as described
in: David Overton. Precise and Expressive Mode Systems for Typed Logic
Programming Languages. University of Melbourne, Department of Computer
Science and Software Engineering. Ph.D. thesis. December, 2003.
<http://www.mercury.csse.unimelb.edu.au/information/papers.html#dmo-thesis>
- Separate assignments and unifications in ANF. Assignments are now
exclusively for loading (or checking) literals.
- Move term base cases out from our myriad of representations into
Dyna.Term.TTerm's TBase.
- Fix comma and whenever handling in ANF (which is a temporary hack)
and while there, make "true" and "false" a little closer to correct.
- Move Analysis.Aggregation over to Main.Exception rather than Either.
- Remove some dead code from Backend.Python and ParserHS.Parser
- While here and there, squash some warnings
- Move handling of the ','/2 and whenever/2 operators into the ANF
processor, next to '*'/1, '&'/1, and is/2, rather than the parser.
- Remove the side-condition field in rule forms
- Fallout from this exposed a really, really bad initialization bug
in the rule planner, which is now hopefully corrected.
This moves us to the much more pleasant position of having one main driver
(in Dyna.Main.Driver) which runs the (common) analysis workers and then
hands off to a user-specified backend (though the interface of
Dyna.Main.BackendDefn). Along the way, we can dump (to stderr or to files)
things we might care about.
Move the python interpreter and debugging tool over to the new pipeline
driver. While doing that, add a "ghcbuild" target to the Makefile that may
behave better than the cabal-istic build mechanism for older GHCs than the
one on my machine.
Add a Python backend selftest module which compares us against "golden"
files in examples/expected/; they are named ".py.out" on the chance that we
get similar golden files for other backends eventually. Wire this in to the
main test harness on the "simple" and "papa2" examples.
While here, move the test harness out of Dyna.Test to Dyna.Main.TestsDriver,
update the README, and move it to Markdown.