Example #1
0
    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)
Example #3
0
File: AST.py Project: liangwang/m5
class AST(PairContainer):
    def __init__(self, slicc, pairs=None):
        self.slicc = slicc
        self.location = Location(slicc.current_file, slicc.lexer.lineno)
        self.pairs = {}
        if pairs:
            self.pairs.update(getattr(pairs, "pairs", pairs))

    @property
    def symtab(self):
        return self.slicc.symtab

    @property
    def state_machine(self):
        return self.slicc.symtab.state_machine

    def warning(self, message, *args):
        self.location.warning(message, *args)

    def error(self, message, *args):
        self.location.error(message, *args)

    def embedError(self, message, *args):
        if args:
            message = message % args
        code = self.slicc.codeFormatter()
        code('''
char c;
cerr << "Runtime Error at ${{self.location}}, Ruby Time: "
     << g_eventQueue_ptr->getTime() << ": "
     << $message
     << ", PID: " << getpid() << endl
     << "press return to continue." << endl;
cin.get(c);
abort();
''')

        return code
Example #4
0
File: AST.py Project: liangwang/m5
 def __init__(self, slicc, pairs=None):
     self.slicc = slicc
     self.location = Location(slicc.current_file, slicc.lexer.lineno)
     self.pairs = {}
     if pairs:
         self.pairs.update(getattr(pairs, "pairs", pairs))