-//runByteCode :: (ByteCode Int Expr) BCState -> [BC]
-//runByteCode (BC f) s = evalState f s
-//runByteCode (BC f) s = fst (f Rd s)
-
-//Start :: Main (ByteCode Int Expr)
-//Start :: [BC]
-Start :: ByteCode Int Expr
-Start = (lit 36 +. lit 42) +. lit 84
+//Start :: ByteCode Int Expr
+//Start = (lit 36 +. lit 42) +. lit 84
+//
+derive consIndex BC
+derive consName BC
+
+Start w
+# (io, w) = stdio w
+# io = io <<< "#ifndef MTASK_H\n#define MTASK_H\n"
+# io = io <<< join "\n" ["#define " +++ consName{|*|} x +++ " " +++ toString (consIndex{|*|} x)\\x<-allBC]
+# (ok, w) = fclose (io <<< "\n#endif\n") w
+| not ok = abort "Couldn't close stdio"
+= w
+ where
+ allBC = [BCNop, BCPush "", BCPop, BCNeg, BCNot, BCAdd, BCSub, BCMul,
+ BCDiv, BCAnd, BCOr, BCEq, BCNeq, BCLes, BCGre, BCLeq, BCGeq,
+ BCJmp 0, BCJmpT 0, BCJmpF 0]