comparison python/c3/scope.py @ 163:8104fc8b5e90

Added visitor to c3
author Windel Bouwman
date Mon, 18 Mar 2013 20:13:57 +0100
parents b28a11c01dbe
children e023d3ce1d63
comparison
equal deleted inserted replaced
162:d8c735dc31f9 163:8104fc8b5e90
21 return self.parent.hasSymbol(name) 21 return self.parent.hasSymbol(name)
22 return False 22 return False
23 def addSymbol(self, sym): 23 def addSymbol(self, sym):
24 self.symbols[sym.name] = sym 24 self.symbols[sym.name] = sym
25 25
26 # buildin types:
27 intType = astnodes.BaseType('int')
28 doubleType = astnodes.BaseType('double')
29 voidType = astnodes.BaseType('void')
30 boolType = astnodes.BaseType('void')
31
26 def createBuiltins(scope): 32 def createBuiltins(scope):
27 for tn in ['int', 'u32', 'u16', 'double', 'void']: 33 for tn in ['u64', 'u32', 'u16', 'u8']:
28 scope.addSymbol(astnodes.BaseType(tn)) 34 scope.addSymbol(astnodes.BaseType(tn))
35 for t in [intType, doubleType, voidType, boolType]:
36 scope.addSymbol(t)
29 37
30 topScope = Scope() 38 topScope = Scope()
31 createBuiltins(topScope) 39 createBuiltins(topScope)
32 40