Report abuse

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
%%{
  machine hello;
  expr = "h";
  main := expr @ { puts "hello world!" } ;
}%%

  %% write data;

def run_machine(data)
  puts "Running the state machine with input #{data}..."
  p = 0
  pe = data.length
  cs = 0

  %% write init;
  %% write exec;
  
  puts "Finished. The state of the machine is: #{cs}"
end

run_machine "h"
run_machine "~h"