blob: 3bd425141dcea81eb766fd4b6942f97506a2a3a1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
require './lib/vfsm'
if ARGV[0] == nil or ARGV[1] == nil then
puts "Usage: ruby vfsm.rb <machine description file> <input>"
exit
end
machine = VFSM::NDFA.new(ARGV[0])
machine.handleinput(ARGV[1])
puts
acc = false
machine.currentnodes.each do |node|
acc = true if node.accepting?
end
if acc then
puts "Valid input, ACCEPTED"
else
puts "Invalid input, REJECTED"
end
|