C compiler with embedded metalanguage.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 

40 行
835 B

@{import("boot.mc");}
@{
toChar(foo) {
"\"type :"+foo+"\"";
}
p2(foo) {
foo * foo;
}
c = ["earth", "sky", "water"];
isSky(x) { x == "sky" }
c = reject(isSky, c);
}
@{print(map(p2, [100, 2, 3]));}
@{print(map(toChar, c));}
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) + "\"" }}
// to_C_string(properties.enums.foo.enumList[?].name.identifier);
a = map(to_C_string, select(isEnum, properties.enums.foo.enumList));
b = map(to_C_string, properties.enums.foo.enumList, notToken);
c = map(to_C_string, properties.enums.foo.enumList, isEnum);
}
char *a[] = { @(a) };
char *b[] = { @(b) };
char *c[] = { @(c) };