Anonymous avatar Anonymous committed 754d223 Draft

Tiny improvement to C boilerplate.

Comments (0)

Files changed (1)

src/castile/backends/c.py

 from castile.transformer import VarDeclTypeAssigner
 
 OPS = {
+  'and': '&&',
+  'or': '||',
 }
 
 
             return 'char *'
         elif type == Void():
             return 'void'
+        elif type == Boolean():
+            return 'int'
         elif isinstance(type, Struct):
             return 'struct %s *' % type.name
         elif isinstance(type, Function):
   printf("%s\n", s);
 }
 
+struct tagged_value {
+    int type;
+    union {
+        void *ptr;
+        int i;
+    }
+};
+
+/*
+struct tagged_value *tag(char *, void *) {
+}
+*/
 """)
             for child in ast.children:
                 self.compile(child)
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.