Commits

Anonymous committed d6a12f2 Draft

Small C backend fixes, "only" 22 fails now. Update README.

Comments (0)

Files changed (2)

 This is the reference distribution for Castile, an unremarkable programming
 language.
 
-The current version of Castile is 0.2.  It is not only subject to change,
+The current version of Castile is 0.3-PRE.  It is not only subject to change,
 it is pretty much *guaranteed* to change.
 
 Unlike most of my programming languages, there is nothing that could really
 often forcing the programmer to be explicit and verbose.
 
 The reference implementation is slightly less unremarkable than the language
-itself, if only for the fact that it compiles to three different target
-languages: Javascript, Ruby, and a hypothetical stack machine called
-"stackmac".  (A stackmac emulator ships with this distribution.)
+itself, if only for the fact that it compiles to four different target
+languages: Javascript, Ruby, a hypothetical stack machine called
+"stackmac" (a stackmac emulator ships with this distribution,) and (coming
+soon) C.
 
 Castile's influences might include:
 

src/castile/backends/c.py

     union {
         void *ptr;
         int i;
-    }
+    };
 };
 
 /*
 }
 
 """)
+            if self.main_type == Boolean():
+                self.out.write(r"""
+
+int main(int argc, char **argv)
+{
+    int x = castile_main();
+    printf("%s\n", x ? "True" : "False");
+    return 0;
+}
+
+""")
         elif ast.tag == 'Defn':
             thing = ast.children[0]
             name = ast.value
             self.compile(ast.children[0])
             self.out.write(')')
         elif ast.tag == 'None':
-            self.out.write('nil')
+            self.out.write('')
         elif ast.tag == 'BoolLit':
             if ast.value:
                 self.out.write("1")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.