;; procedure that simulates the behavior of an nfa ;; transition-table is a list of tuples, the first two items in each list are the current ;; state and input, and the third item in the list is the transition state ;; ((p 0 q) (p 1 r) ...) ;; start state is a number that denotes the starting state for the nfa ;; 1 ;; accepted-states is a list of accepted ending states ;; (p q r s) ;; input is the input string for the nfa ;; "01001" (define nfa (lambda (transition-table start-state accepted-states input) (let loop ([stop (string-length input)] [counter 0]) (if (= stop counter) (error 'nfa "input not accepted ~s" input) (let ([current-input (string-ref input counter)]) (let end-state-loop ([end-states accepted-states]) (cond [(null? end-states) ] [()])))))))