From dde7dcf9ddd1e96019f37c829c48ae89a85ed072 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Wed, 26 Jul 2023 14:15:29 +0200 Subject: [PATCH] Change pretty printing of state instructions. --- .../src/main/scala/effekt/machine/PrettyPrinter.scala | 6 +++--- effekt/shared/src/main/scala/effekt/machine/Tree.scala | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/effekt/shared/src/main/scala/effekt/machine/PrettyPrinter.scala b/effekt/shared/src/main/scala/effekt/machine/PrettyPrinter.scala index 7d304d996..aa1006501 100644 --- a/effekt/shared/src/main/scala/effekt/machine/PrettyPrinter.scala +++ b/effekt/shared/src/main/scala/effekt/machine/PrettyPrinter.scala @@ -65,13 +65,13 @@ object PrettyPrinter extends ParenPrettyPrinter { "invoke" <+> receiver <> "." <> tag.toString <> parens(arguments map toDoc) case Allocate(name, init, ev, rest) => - toDoc(name.tpe) <+> name <> "<" <> ev <> ">" <+> "=" <+> init <> ";" <> line <> toDoc(rest) + "let" <+> name <+> "=" <+> "allocate" <> parens(List(init, ev) map toDoc) <> ";" <> line <> toDoc(rest) case Load(name, ref, ev, rest) => - name <+> "=" <+> "*" <> ref <> "<" <> ev <> ">" <> ";" <> line <> toDoc(rest) + "let" <+> name <+> "=" <+> "load" <> parens(List(ref, ev) map toDoc) <> ";" <> line <> toDoc(rest) case Store(ref, value, ev, rest) => - "*" <> ref <> "<" <> ev <> ">" <+> "=" <+> value <> ";" <> line <> toDoc(rest) + "store" <> parens(List(ref, ev, value) map toDoc) <> ";" <> line <> toDoc(rest) case PushFrame(frame, rest) => "push" <+> toDoc(frame) <> ";" <> line <> toDoc(rest) diff --git a/effekt/shared/src/main/scala/effekt/machine/Tree.scala b/effekt/shared/src/main/scala/effekt/machine/Tree.scala index a505504ac..49a6a4d23 100644 --- a/effekt/shared/src/main/scala/effekt/machine/Tree.scala +++ b/effekt/shared/src/main/scala/effekt/machine/Tree.scala @@ -137,17 +137,17 @@ enum Statement { case Invoke(receiver: Variable, tag: Tag, arguments: Environment) /** - * e.g. Int x in r = 42; s + * e.g. let x = allocate(42, ev); s */ case Allocate(name: Variable, init: Variable, ev: Variable, rest: Statement) /** - * e.g. y = *x; s + * e.g. let y = load(x, ev); s */ case Load(name: Variable, ref: Variable, ev: Variable, rest: Statement) /** - * e.g. *x = 42; s + * e.g. store(x, 42, ev); s */ case Store(ref: Variable, value: Variable, ev: Variable, rest: Statement)