Made some progress

main
Sam Hatfield 2021-07-21 11:13:08 -05:00
parent a6251266ec
commit 9c35e607cc
4 changed files with 38 additions and 21 deletions

View File

@ -1,20 +1,14 @@
module tiltsys/database
open tiltsys/tree as T
sig Hash {}
open tiltsys/graph as G
open tiltsys/evaluator as E
some sig Database {
entry: Hash -> T/Tree,
hashes: T/Tree -> Hash
graphs: set G/Graph,
evaluator: one E/Evaluator
} {
entry = ~hashes
G/Graph in graphs
E/Evaluator in evaluator
}
pred show [] {}
run show for 3
pred add [d, d': Database, t: T/Tree, h: Hash] {
d'.entry = d.entry + h -> t
d'.hashes = d.hashes + t -> h
}
run add for 4 but 2 Database

3
evaluator.als Normal file
View File

@ -0,0 +1,3 @@
module tiltsys/evaluator
sig Evaluator {}

29
graph.als Normal file
View File

@ -0,0 +1,29 @@
module tiltsys/graph
abstract sig Node, Type {}
one sig Bottom extends Node {}
sig Datum extends Node {
value: Type
}
some sig Graph {
// tops are the opposite of Bottom: they serve as starting points for traversal
tops: some Datum,
to: Node -> Node,
types: set Type
} {
// Capture instances
Node in tops + tops.^to
Type in types
// Bottom only gets pointed at
all n: Node | Bottom -> n not in to
// acyclic
no to & iden
}
pred show [] {}
run show for 4

View File

@ -1,9 +0,0 @@
module tiltsys/tree
sig Node {
left, right: lone Node
}
sig Tree {
nodes: set Node
}