Browse Source

cleanup

rlbr-dev
Larry Xue 5 years ago
parent
commit
be8852dd7f
  1. 0
      LICENSE
  2. 3
      README.md
  3. 3
      c2logic/compiler.py
  4. 1
      include/io.h
  5. 0
      mypy.ini

0
LICENSE

3
README.md

@ -41,7 +41,7 @@ See [include/builtins.h](./include/builtins.h) for API definitions and [examples
# Supported Features
- all Mindustry instructions as of BE 9420
- all C control flow structures except goto and switch
- all C control flow structures except switch
- functions
- local/global variables
@ -55,4 +55,3 @@ See [include/builtins.h](./include/builtins.h) for API definitions and [examples
- typedefs - use macros
- pointers - don't use them
- switch - use if-else chains
- goto - don't use it

3
c2logic/compiler.py

@ -271,6 +271,7 @@ class Compiler(c_ast.NodeVisitor):
self.push(Set("__rax", "null"))
self.push_ret()
self.functions[func_name] = self.curr_function
self.curr_function = None
def visit_Decl(self, node):
if isinstance(node.type, TypeDecl): # variable declaration
@ -416,7 +417,7 @@ class Compiler(c_ast.NodeVisitor):
def visit_Return(self, node):
if node.expr is None:
self.push(Set("__rax","null"))
self.push(Set("__rax", "null"))
else:
self.visit(node.expr)
self.push_ret()

1
include/io.h

@ -1,5 +1,6 @@
#ifndef IO_H
#define IO_H
#include "c2logic/builtins.h"
void println(char* s) {
print(s);
print("\n");

0
mypy.ini

Loading…
Cancel
Save