use semantic store class

This commit is contained in:
Mark Canlas 2022-10-19 12:24:12 -07:00
parent 167705f625
commit 021fb3b2e8
2 changed files with 7 additions and 10 deletions

View File

@ -44,3 +44,8 @@ case class AndThen2[A, B](x: Asm2[A, B], y: Asm2[A, B]) extends Asm2[A, B]:
x.xs ++ y.xs
case class R[A]()
// TODO needs evidence that it is a storable target of one thing
case class StoreTo[A: Store, B]() extends Asm2[A, B]:
def xs: List[String] =
Nil

View File

@ -5,16 +5,8 @@ package object syntax:
def writeConst[A: Loadable](x: A): syntax.PartiallyAppliedWrite[A, Addr] =
new syntax.PartiallyAppliedWrite(reg, x)
def writeFrom[R: Store]: Asm2Instructions[R, Addr] =
val storeInstruction =
Store[R].to
val storeStr =
s"$storeInstruction ${reg.n.toString}"
// TODO encoding now already makes the structures lose semantic meaning
// TODO maybe AsmN's should be traits such that semantic structures can just obey the contracts and be AND'ed
Asm2Instructions(List(s"$storeInstruction ${reg.n.toString}"))
def writeFrom[R: Store]: Asm2[R, Addr] =
StoreTo[R, Addr]()
class PartiallyAppliedWrite[Addr: Loadable, A](reg: WriteAddress[A], x: Addr):
def apply[R: Load: Store: Register]: String =