예제 #1
0
 def _firstPass(self, line):
     # if line contain a loop marker
     if fh.isLoopMarker(line):
         loopMark = line[1:-1]
         # store it in the symbol hash table
         self._ht.addSymbol(loopMark, self._lineCount + 1)
     else:
         # count number of parseable code lines
         self._lineCount += 1
예제 #2
0
 def _secPass(self, line):
     line = fh.removeInlineComments(line)
     # check if it's a instruction
     if fh.isAInst(line):
         # handle a-instruction
         self._handleAInst(line[1:])
     # else must be a c-instruction
     elif not fh.isLoopMarker(line):
         # handle c-instruction
         self._handleCInst(line)