summaryrefslogtreecommitdiff
path: root/starts/meaning-vm
diff options
context:
space:
mode:
Diffstat (limited to 'starts/meaning-vm')
-rw-r--r--starts/meaning-vm/level-1/concepts.cpp1
-rw-r--r--starts/meaning-vm/level-1/concepts.hpp1
-rw-r--r--starts/meaning-vm/level-1/funcs.cpp8
-rw-r--r--starts/meaning-vm/level-1/memorystore.cpp33
-rw-r--r--starts/meaning-vm/level-1/memorystore.hpp14
-rw-r--r--starts/meaning-vm/level-2/funcs.cpp2
6 files changed, 58 insertions, 1 deletions
diff --git a/starts/meaning-vm/level-1/concepts.cpp b/starts/meaning-vm/level-1/concepts.cpp
index 51cd693..890d8b2 100644
--- a/starts/meaning-vm/level-1/concepts.cpp
+++ b/starts/meaning-vm/level-1/concepts.cpp
@@ -9,6 +9,7 @@ ref is("is");
ref anonymous("anonymous");
ref link("link");
ref name("name");
+ref allocation("allocation"), part("part"), group("group");
}
}
diff --git a/starts/meaning-vm/level-1/concepts.hpp b/starts/meaning-vm/level-1/concepts.hpp
index 6dfc64b..b75133e 100644
--- a/starts/meaning-vm/level-1/concepts.hpp
+++ b/starts/meaning-vm/level-1/concepts.hpp
@@ -12,6 +12,7 @@ extern ref name; // used as the link to value<std::string> naming each concept
extern ref is; // a link to define group relationships, links to the more general class
extern ref anonymous; // a group given concepts with generated names
extern ref link; // TODO: for concepts that are links, link them with is=link
+extern ref allocation, part, group; // links structuring allocation groups
//extern ref true, false; <-- casting provides as if these were declared
}
diff --git a/starts/meaning-vm/level-1/funcs.cpp b/starts/meaning-vm/level-1/funcs.cpp
index 72d3c27..c1cf21a 100644
--- a/starts/meaning-vm/level-1/funcs.cpp
+++ b/starts/meaning-vm/level-1/funcs.cpp
@@ -29,6 +29,14 @@ static auto & namestruct()
return namestruct;
}
+void givename(concept* con, std::string const & name)
+{
+ auto & ns = namestruct();
+ level0::ref namestr = level0::alloc(name);
+ ns.conceptsByName.emplace(namestr.val<std::string>(), con);
+ con.set(ns.nameref, namestr);
+}
+
concept* getnamed(std::string const & name)
{
auto & ns = namestruct();
diff --git a/starts/meaning-vm/level-1/memorystore.cpp b/starts/meaning-vm/level-1/memorystore.cpp
new file mode 100644
index 0000000..0bd109b
--- /dev/null
+++ b/starts/meaning-vm/level-1/memorystore.cpp
@@ -0,0 +1,33 @@
+#include "memorystore.hpp"
+
+#include "concepts.hpp"
+
+#include "../level-0/memorystore.hpp"
+
+namespace intellect {
+namespace level1 {
+
+ref allocation_group("allocation-group");
+ref allocation_part("allocation-part");
+
+ref alloc(ref grp, std::any data)
+{
+ ref res = level0::alloc(data);
+ keep(res, grp);
+}
+
+void keep(ref allocated, ref grp)
+{
+ allocated.link(allocation_group, grp);
+ grp.link(allocation_part, allocated);
+}
+
+void dealloc(ref grp, ref metagroup)
+{
+
+//}
+
+std::size_t allocatedgroups();
+
+}
+}
diff --git a/starts/meaning-vm/level-1/memorystore.hpp b/starts/meaning-vm/level-1/memorystore.hpp
new file mode 100644
index 0000000..625dad9
--- /dev/null
+++ b/starts/meaning-vm/level-1/memorystore.hpp
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "common.hpp"
+
+namespace intellect {
+namespace level1 {
+
+ref alloc(ref group, std::any data = {});
+void keep(ref allocated, ref group);
+void dealloc(ref group, ref metagroup = concepts::nothing);
+std::size_t allocatedgroups();
+
+}
+}
diff --git a/starts/meaning-vm/level-2/funcs.cpp b/starts/meaning-vm/level-2/funcs.cpp
index ed50c39..a8835f4 100644
--- a/starts/meaning-vm/level-2/funcs.cpp
+++ b/starts/meaning-vm/level-2/funcs.cpp
@@ -40,7 +40,7 @@ ref dohabit(ref habit, std::initializer_list<ref> args)
throw std::invalid_argument("wrong number of arguments to habit");
}
posarg = posarg[next-positional-argument];
- // TODO: subcontexts
+ // TODO: subcontexts or call instances
ref::context().set(posarg[argument], arg);
}
if (posarg.linked(next-positional-argument)) {