diff --git a/c2logic/compiler.py b/c2logic/compiler.py index 638d64a..be1d714 100644 --- a/c2logic/compiler.py +++ b/c2logic/compiler.py @@ -8,7 +8,7 @@ from pycparser.c_ast import ( Compound, Constant, DeclList, Enum, FileAST, FuncDecl, Struct, TypeDecl, Typename ) -from .consts import builtins, func_binary_ops, func_unary_ops +from .consts import func_binary_ops, func_unary_ops from .instructions import ( Instruction, Noop, @@ -299,7 +299,7 @@ class Compiler(c_ast.NodeVisitor): self.visit(node.init) self.set_to_rax(varname) elif isinstance(node.type, FuncDecl): - if node.name not in builtins + func_unary_ops + func_binary_ops: + if node.name not in list(PARSED_INSTRUCTIONS.keys()) + func_unary_ops + func_binary_ops: #create placeholder function for forward declarations func_decl = node.type if func_decl.args is None or isinstance(func_decl.args.params[0], Typename): diff --git a/c2logic/consts.py b/c2logic/consts.py index 96f7471..9e80e92 100644 --- a/c2logic/consts.py +++ b/c2logic/consts.py @@ -26,7 +26,6 @@ condition_ops = { ">": "greaterThan", ">=": "greaterThanEq" } -#TODO remove negate b/c its deprecated unary_ops = {"~": "not"} binary_op_inverses = {"==": "!=", "!=": "==", "<": ">=", "<=": ">", ">": "<=", ">=": "<"} @@ -35,8 +34,3 @@ func_binary_ops = ["pow", "max", "min", "angle", "len", "land", "idiv", "strictE func_unary_ops = ["abs", "log", "log10", "sin", "cos", "tan", "floor", "ceil", "sqrt", "rand"] binary_ops.update(dict(zip(func_binary_ops, func_binary_ops))) unary_ops.update(dict(zip(func_unary_ops, func_unary_ops))) - -builtins = [ - "print", "printd", "printflush", "radar", "sensor", "enable", "shoot", "get_link", "read", - "write", "drawflush", "end" -]