Index: libcfa/prelude/builtins.c
===================================================================
--- libcfa/prelude/builtins.c	(revision 8c9da33ccd24f6ebb19003bcfa35de0cf69ac73e)
+++ libcfa/prelude/builtins.c	(revision 9306559f2fb7cb170efbe0a74f6e55fbf414688a)
@@ -48,4 +48,28 @@
 void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ ));
 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));
+
+forall(dtype T)
+static inline T & identity(T & i) {
+	return i;
+}
+
+// generator support
+struct $generator {
+	inline int;
+};
+
+static inline void  ?{}($generator & this) { ((int&)this) = 0; }
+static inline void ^?{}($generator &) {}
+
+trait is_generator(dtype T) {
+      void main(T & this);
+      $generator * get_generator(T & this);
+};
+
+forall(dtype T | is_generator(T))
+static inline T & resume(T & gen) {
+	main(gen);
+	return gen;
+}
 
 // implicit increment, decrement if += defined, and implicit not if != defined
