C compiler with embedded metalanguage.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

20 lines
529 B

@{import("../src/parsimonyLibrary/boot.mc");}
enum foo { A, B, C };
enum oof { A, B, C };
@{
isEnum(x) { x.__proto__ == C_enum }
notToken(x) { x.__proto__ != Token }
to_C_string(x) {{ __proto__: C_string, value: "\"" + string(x.name.identifier) + "\"" }}
a = map(to_C_string, select(isEnum, program.enums.foo.enumList));
b = map(to_C_string, program.enums.foo.enumList, notToken);
c = map(to_C_string, program.enums.foo.enumList, isEnum);
nil;
}
char *a[] = { @a };
char *b[] = { @b };
char *c[] = { @c };