aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/tool/compiler/statement.lux
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source/lux/tool/compiler/statement.lux')
-rw-r--r--stdlib/source/lux/tool/compiler/statement.lux46
1 files changed, 46 insertions, 0 deletions
diff --git a/stdlib/source/lux/tool/compiler/statement.lux b/stdlib/source/lux/tool/compiler/statement.lux
new file mode 100644
index 000000000..c4a8b56b1
--- /dev/null
+++ b/stdlib/source/lux/tool/compiler/statement.lux
@@ -0,0 +1,46 @@
+(.module:
+ [lux #*]
+ [//
+ ["." analysis]
+ ["." synthesis]
+ ["." phase
+ ["." translation]
+ ["." extension]]])
+
+(type: #export (Component state phase)
+ {#state state
+ #phase phase})
+
+(type: #export (State anchor expression statement)
+ {#analysis (Component analysis.State+
+ analysis.Phase)
+ #synthesis (Component synthesis.State+
+ synthesis.Phase)
+ #translation (Component (translation.State+ anchor expression statement)
+ (translation.Phase anchor expression statement))})
+
+(do-template [<special> <general>]
+ [(type: #export (<special> anchor expression statement)
+ (<general> (..State anchor expression statement) Code Any))]
+
+ [State+ extension.State]
+ [Operation extension.Operation]
+ [Phase extension.Phase]
+ [Handler extension.Handler]
+ [Bundle extension.Bundle]
+ )
+
+(do-template [<name> <component> <operation>]
+ [(def: #export (<name> operation)
+ (All [anchor expression statement output]
+ (-> (<operation> output)
+ (Operation anchor expression statement output)))
+ (extension.lift
+ (phase.sub [(get@ [<component> #..state])
+ (set@ [<component> #..state])]
+ operation)))]
+
+ [lift-analysis #..analysis analysis.Operation]
+ [lift-synthesis #..synthesis synthesis.Operation]
+ [lift-translation #..translation (translation.Operation anchor expression statement)]
+ )