def __init__(self, slicc): self.slicc = slicc self.sym_vec = [] self.sym_map_vec = [ {} ] self.machine_components = {} pairs = {} pairs["enumeration"] = "yes" MachineType = Type(self, "MachineType", Location("init", 0), pairs) self.newSymbol(MachineType) pairs = {} pairs["primitive"] = "yes" pairs["external"] = "yes" void = Type(self, "void", Location("init", 0), pairs) self.newSymbol(void)
def __init__(self, slicc): self.slicc = slicc self.sym_vec = [] self.sym_map_vec = [{}] self.machine_components = {} pairs = {} pairs["enumeration"] = "yes" location = Location("init", 0, no_warning=not slicc.verbose) MachineType = Type(self, "MachineType", location, pairs) self.newSymbol(MachineType) pairs = {} pairs["primitive"] = "yes" pairs["external"] = "yes" location = Location("init", 0, no_warning=not slicc.verbose) void = Type(self, "void", location, pairs) self.newSymbol(void)
def generate(self): ident = str(self.type_ast) # Make the new type new_type = Type(self.symtab, ident, self.location, self.pairs, self.state_machine) self.symtab.newSymbol(new_type) # Add all of the fields of the type to it for field in self.field_asts: field.generate(new_type)
def generate(self): ident = str(self.type_ast) machine = self.symtab.state_machine # Make the new type new_type = Type(self.symtab, ident, self.location, self.pairs, self.state_machine) if machine: machine.addType(new_type) self.symtab.newSymbol(new_type) self.symtab.pushFrame() # Add all of the fields of the type to it for field in self.field_asts: field.generate(new_type) self.symtab.popFrame()