pyexpression: + Variable + make_var
This commit is contained in:
parent
97c0613fee
commit
7fcb0026f1
1 changed files with 11 additions and 0 deletions
|
|
@ -8,6 +8,7 @@
|
|||
#include "xo/expression/Primitive.hpp"
|
||||
#include "xo/expression/ConstantInterface.hpp"
|
||||
#include "xo/expression/Constant.hpp"
|
||||
#include "xo/expression/Variable.hpp"
|
||||
#include "xo/pyutil/pyutil.hpp"
|
||||
#include <pybind11/functional.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
|
@ -23,6 +24,8 @@ namespace xo {
|
|||
using xo::ast::make_primitive;
|
||||
using xo::ast::ConstantInterface;
|
||||
using xo::ast::Constant;
|
||||
using xo::ast::Variable;
|
||||
using xo::ast::make_var;
|
||||
using xo::reflect::TaggedPtr;
|
||||
using xo::ref::rp;
|
||||
namespace py = pybind11;
|
||||
|
|
@ -117,6 +120,14 @@ namespace xo {
|
|||
|
||||
m.def("make_apply", &make_apply);
|
||||
|
||||
// ----- Variables -----
|
||||
|
||||
py::class_<Variable, Expression, rp<Variable>>(m, "Variable")
|
||||
.def_property_readonly("name", &Variable::name, py::doc("variable name"))
|
||||
;
|
||||
|
||||
m.def("make_var", &make_var);
|
||||
|
||||
} /*pyexpresion*/
|
||||
} /*namespace ast*/
|
||||
} /*namespace xo*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue