4 # Generic "two languages" polyglot
5 class Biglot < Polyglot
7 # A Biglot is defined by its name, the first language, the second language, and an array of transitions
8 # Each transition is specified as an array of parameters to initialize a StitchTransition
9 def initialize(name, lang1, lang2, states, trans)
12 @states = (lang1.all_states rescue lang1.states) + (lang2.all_states rescue lang2.states)
15 @transitions = (lang1.all_transitions rescue lang1.transitions) + (lang2.all_transitions rescue lang2.transitions)
16 @extra_transitions = []
18 states.each { |ar| @extra_states << State.new(*ar) }
19 trans.each { |ar| @extra_transitions << StitchTransition.new(*ar) }