--- /dev/null
+/*
+ * @LANG: d
+ */
+
+import std.c.stdio;
+import std.string;
+
+%%{
+ machine test;
+
+ export c1 = 'c';
+ export c2 = 'z';
+ export c3 = 't';
+
+ commands := (
+ c1 . digit* '\n' @{ printf( "c1\n" );} |
+ c2 . alpha* '\n' @{ printf( "c2\n" );}|
+ c3 . '.'* '\n' @{ printf( "c3\n" );}
+ )*;
+
+ some_other := any*;
+}%%
+
+%% write exports;
+%% write data;
+
+int test( char data[] )
+{
+ int cs = test_en_commands;
+ char *p = data.ptr, pe = data.ptr + data.length;
+
+ %% write init;
+ %% write exec;
+
+ if ( cs >= test_first_final )
+ printf("ACCEPT\n");
+ else
+ printf("ERROR\n");
+ return 0;
+}
+
+char data[] = [
+ test_ex_c1, '1', '2', '\n',
+ test_ex_c2, 'a', 'b', '\n',
+ test_ex_c3, '.', '.', '\n'
+];
+
+int main()
+{
+ test( data );
+ return 0;
+}
+
+/+ _____OUTPUT_____
+c1
+c2
+c3
+ACCEPT
+++++++++++++++++++/
--- /dev/null
+/*
+ * @LANG: c
+ */
+
+#include <stdio.h>
+
+char *foo = "foo";
+
+char b = 98;
+char a = 97;
+char r = 114;
+
+#define SP 32
+#define NL '\n'
+
+%%{
+ machine tmp;
+ import "import1.rl";
+
+ foobar =
+ foo @{printf("foo\n"); } |
+ b a r @{printf("bar\n");};
+
+ main := ( foobar SP foobar NL )*;
+}%%
+
+%% write data;
+
+int cs;
+
+void exec_str( char *p, int len )
+{
+ char *pe = p + len;
+ %% write exec;
+}
+
+void exec_c( char c )
+{
+ exec_str( &c, 1 );
+}
+
+int main()
+{
+ %% write init;
+
+ exec_str( foo, 3 );
+ exec_c( SP );
+ exec_c( b );
+ exec_c( a );
+ exec_c( r );
+ exec_c( NL );
+
+ exec_c( b );
+ exec_c( a );
+ exec_c( r );
+ exec_c( SP );
+ exec_str( foo, 3 );
+ exec_c( NL );
+
+ if ( cs < tmp_first_final )
+ printf("FAIL\n");
+ else
+ printf("ACCEPT\n");
+
+ return 0;
+}
+#ifdef _____OUTPUT_____
+foo
+bar
+bar
+foo
+ACCEPT
+#endif