       type = automaton.type
       mode = automaton.mode
 
-      @faStack.push automaton
+      # push the current FA to top of the stack
+      @faStack = [automaton].concat @faStack
       res = @matchState 0
-      @faStack.pop()
+      # pop from the stack
+      @faStack = @faStack.slice 1
 
       value = switch mode
         when FA.POS

      acc = ""
      indent = 0
      toStringIter =(ast) ->
        for i in [0...indent]
          acc += '    '
        if indent > 0
          acc += '->  '
        acc += ast.type

          if c >= aa[0] and c <= aa[1]
            true
          else
            if c > aa[1]
              @withinSet set, index + 1, c
            else
              false
