       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

              false

      if res
        tran_res = @matchState edge.state
        if tranRes
          # if the edge we moved along wasn't supposed to include it's result
          # or the result was empty, just return the stuff after it


waxeye = (->

  # an edge in the FA graph
  # trans - the condition that must be met to transition along this edge
  # state - the state to transition to
  # voided - if the result of the transition condition will be included in the AST
  class Edge
    constructor: (@trans, @state, @voided) ->


  # a state in the FA graph
  # edges - the edges leading out of this state
  # match - if the state is an accepting state
  class State
    constructor: (@edges, @match) ->


  # an FA in the FA graph
  # type - the type of AST that will be created
  # states - the states of the FA. State 0 is the starting state
  class FA
    constructor: (@type, @states, @mode) ->
  FA.VOID = 0
