aboutsummaryrefslogtreecommitdiff
path: root/src/schedule.c
diff options
context:
space:
mode:
authorMarvin Borner2023-05-31 13:21:24 +0200
committerMarvin Borner2023-05-31 13:21:24 +0200
commit931df5e774eebb098c5d7be93937d2b2f12b86ac (patch)
treeec60efb28549b4f83a42bbb41a2c702c0565e3b5 /src/schedule.c
parentd347a2fa6483059e6397d2b70e82aa657f1144d2 (diff)
Added parent hashmaps
Diffstat (limited to 'src/schedule.c')
-rw-r--r--src/schedule.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/schedule.c b/src/schedule.c
index dda08f3..3465752 100644
--- a/src/schedule.c
+++ b/src/schedule.c
@@ -6,10 +6,13 @@
#include <stdlib.h>
#include <schedule.h>
+#include <reduce.h>
#include <lib/pqueue.h>
+#include <log.h>
#include <parse.h>
#include <map.h>
+// queue of beta-redexes: ([X], Y)
static struct pqueue *queue;
static pqueue_pri_t get_pri(void *a)
@@ -40,16 +43,18 @@ static size_t choose_position(void)
void schedule(void)
{
while (pqueue_size(queue) > 0) {
+ // TODO: check finished programs
size_t position = choose_position();
struct term *term = pqueue_pop_at(queue, position);
- // TODO: reduce term
+ reduce(term);
}
+ debug("no more redexes!\n");
}
void schedule_init(void)
{
srand(time(0));
- queue = map_to_pqueue(cmp_pri, get_pri, set_pos);
+ queue = map_to_pqueue(map_all_terms(), cmp_pri, get_pri, set_pos);
}
void schedule_destroy(void)