git @ Cat's Eye Technologies Castile / 7316394
Small C backend fixes, "only" 22 fails now. Update README. catseye 12 years ago
2 changed file(s) with 18 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
33 This is the reference distribution for Castile, an unremarkable programming
44 language.
55
6 The current version of Castile is 0.2. It is not only subject to change,
6 The current version of Castile is 0.3-PRE. It is not only subject to change,
77 it is pretty much *guaranteed* to change.
88
99 Unlike most of my programming languages, there is nothing that could really
1212 often forcing the programmer to be explicit and verbose.
1313
1414 The reference implementation is slightly less unremarkable than the language
15 itself, if only for the fact that it compiles to three different target
16 languages: Javascript, Ruby, and a hypothetical stack machine called
17 "stackmac". (A stackmac emulator ships with this distribution.)
15 itself, if only for the fact that it compiles to four different target
16 languages: Javascript, Ruby, a hypothetical stack machine called
17 "stackmac" (a stackmac emulator ships with this distribution,) and (coming
18 soon) C.
1819
1920 Castile's influences might include:
2021
5959 union {
6060 void *ptr;
6161 int i;
62 }
62 };
6363 };
6464
6565 /*
8686 {
8787 int x = castile_main();
8888 printf("%d\n", x);
89 return 0;
90 }
91
92 """)
93 if self.main_type == Boolean():
94 self.out.write(r"""
95
96 int main(int argc, char **argv)
97 {
98 int x = castile_main();
99 printf("%s\n", x ? "True" : "False");
89100 return 0;
90101 }
91102
174185 self.compile(ast.children[0])
175186 self.out.write(')')
176187 elif ast.tag == 'None':
177 self.out.write('nil')
188 self.out.write('')
178189 elif ast.tag == 'BoolLit':
179190 if ast.value:
180191 self.out.write("1")