daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   ruby-1.8.6-p383 > Hopcroft::Regex.parse("a|b")
  2.    => #<Hopcroft::Regex::Alternation:0x122698c @expressions=[#<Hopcroft::Regex::Char:0x12240ec @expression="a">, #<Hopcroft::Regex::Char:0x1224a4c @expression="b">]>
  3.   ruby-1.8.6-p383 > Hopcroft::Regex.parse("a|b").to_machine
  4.    => #<Hopcroft::Machine::StateMachine:0x121f074 @start_state=State 1 {start: true, final: false, transitions: 2}>
  5.   ruby-1.8.6-p383 > Hopcroft::Regex.parse("a|b").to_machine.to_dfa
  6.    => #<Hopcroft::Machine::StateMachine:0x120d630 @start_state=State 12 {start: true, final: false, transitions: 2}>
  7.  
  8.   ruby-1.8.6-p383 > Hopcroft::Regex.parse("a|b").to_machine
  9.    => #<Hopcroft::Machine::StateMachine:0x5f1b1c @start_state=State 24 {start: true, final: false, transitions: 2}>
  10.   ruby-1.8.6-p383 > Hopcroft::Regex.parse("a|b").to_machine.state_table
  11.    =>
  12.   +-------------+------------+------------+--------------------------------------+
  13.   |             | b          | a          | Hopcroft::Machine::EpsilonTransition |
  14.   +-------------+------------+------------+--------------------------------------+
  15.   | State 32    | * State 33 |            |                                      |
  16.   | State 30    |            | * State 31 |                                      |
  17.   | -> State 29 |            |            | State 30, State 32                   |
  18.   +-------------+------------+------------+--------------------------------------+
  19.  
  20.   ruby-1.8.6-p383 > Hopcroft::Regex.parse("a|b").to_machine.to_dfa.state_table
  21.    =>
  22.   +-------------+----------+----------+
  23.   |             | a        | b        |
  24.   +-------------+----------+----------+
  25.   | -> State 21 | State 22 | State 23 |
  26.   +-------------+----------+----------+
RAW Paste Data
Top