C compiler with embedded metalanguage.
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

40 righe
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) };