xo-interpreter: apply expressions + llvm builtins working!
This commit is contained in:
parent
7ca1366bec
commit
1d1e72adf3
31 changed files with 531 additions and 50 deletions
|
|
@ -56,6 +56,8 @@ namespace xo {
|
|||
explicit Primitive(std::string_view name,
|
||||
function_type fn) : PrimitiveBase<Ret (*)(Arg1, Arg2)>{name, fn} {}
|
||||
|
||||
/** see also AdoptPrimitiveExpr::adopt() in xo-interpreter/AdoptPrimitiveExpr.hp **/
|
||||
|
||||
// inherited from Procedure..
|
||||
|
||||
virtual std::size_t n_args() const final override { return 2; }
|
||||
|
|
@ -100,6 +102,7 @@ namespace xo {
|
|||
make_primitive(gc::IAlloc * mm, std::string_view name, Fn fn) {
|
||||
return new (MMPtr(mm)) Primitive<Fn>(name, fn);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@ namespace xo {
|
|||
**/
|
||||
class Procedure : public Object {
|
||||
public:
|
||||
/** downcast from @p x iff x is actually a Procedure. Otherwise nullptr **/
|
||||
static gp<Procedure> from(gp<Object> x) { return gp<Procedure>::from(x); }
|
||||
|
||||
virtual std::size_t n_args() const = 0;
|
||||
virtual gp<Object> apply_nocheck(gc::IAlloc * mm, const CVector<gp<Object>> & args) = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue