Skip to content

Commit 8824613

Browse files
committed
Basic working version bound to Python
1 parent 3995756 commit 8824613

File tree

5 files changed

+2220
-3
lines changed

5 files changed

+2220
-3
lines changed

bindings/core/src/core.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,15 @@ simplify(std::shared_ptr<KOREPattern> pattern, std::shared_ptr<KORESort> sort) {
7272
std::shared_ptr<KOREPattern> evaluate_function(
7373
std::string const &label,
7474
std::vector<std::shared_ptr<KOREPattern>> const &args) {
75-
abort();
75+
auto term_args = std::vector<void *>{};
76+
for (auto const &arg : args) {
77+
term_args.push_back(static_cast<void *>(construct_term(arg)));
78+
}
79+
80+
auto tag = getTagForSymbolName(label.c_str());
81+
auto result = evaluateFunctionSymbol(tag, term_args.data());
82+
83+
return term_to_pattern(static_cast<block *>(result));
7684
}
7785

7886
bool is_sort_kitem(std::shared_ptr<KORESort> const &sort) {

bindings/python/runtime.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <kllvm/bindings/core/core.h>
33

44
#include <pybind11/pybind11.h>
5+
#include <pybind11/stl.h>
56

67
// This header needs to be included last because it pollutes a number of macro
78
// definitions into the global namespace.
@@ -55,8 +56,6 @@ void bind_runtime(py::module_ &m) {
5556

5657
m.def("return_sort_for_label", bindings::return_sort_for_label);
5758

58-
m.def("simplify_bool_pattern", bindings::simplify_to_bool);
59-
6059
m.def("evaluate_function", bindings::evaluate_function);
6160

6261
// This class can't be used directly from Python; the mutability semantics

0 commit comments

Comments
 (0)