kamel-usp/dpasp

#Include directives

Opened this issue · 1 comments

Allow for a #include "filename.py" or #include "filename.plp" directive that is equivalent to the Python snippet #python #end, but can be used to split a dpasp program into several files. The type of snipper can be deduced from the file extension. That should also help to make things more efficient, as e.g., we might pre-compile python files or pre-ground plp files.

  • Add support for #include "filename.plp" (see 1352f74)
    • For the logic and probabilistic part of the program, the order of #includes should not matter. However, it does matter for the order of #query's and for setting #semantics. The current behavior for #query is top-down for order of #includes within a file, and breadth-first-search-like for nested #include's.
    • #python guards should work out of the box, but data should have the same dimensions. E.g. if file a.plp contains #include "b.py" and has test data of dimension $d$, then so should the data in b.plp (if a #python block exists). The same must also be true for train data.
    • For now a simple cycle free implementation prevents infinite #includes by simply storing whether that file has been #included before. Since order does not (semantically) matter in dPASP, it should not change probabilities, but this should be taken into account when evaluating the output tensor, since the order of #query's can be tricky in more complicated programs with several nested #includes.
  • Add support for #include "filename.py"