190 likes | 298 Views
Simple Languages and Concatenation-State Machines. Solidum 1997-2002 Acquired by IDT Corp. In 2002 Packet classification programmable chips Transmission-time speed Using state-machine technology Stateless stack automaton Hundreds of thousands of states
E N D
Simple Languages and Concatenation-State Machines • Solidum 1997-2002 • Acquired by IDT Corp. In 2002 • Packet classification programmable chips • Transmission-time speed • Using state-machine technology • Stateless stack automaton • Hundreds of thousands of states • Algorithm time complexities were critical • Possibility of reading more than one input symbol per memory cycle
Simple Languages and Concatenation-State Machines Joint work with WojtekFraczak (IDT), LeszekGasieniec (Liverpool), WojciechRytter (Warsaw), FeliksWelfeld (IDT) + MsC and PhD students
Concatenation-State Machine (CSM) • C = (S ,S, C, i, f, tS, tC) • S - input alphabet • S - switch (transition) states • C – concatenation states • i – initial state, i SC • A – accept (terminal) state, A SC • tS – switch state transition function tS: S x S SC {A} • tC – concatenation state transition function tC: C SC {A} x SC {A}
Concatenation-State Machine 1 L = {abb, bba} a b 2 b 3 4 b a A • Example 1
Concatenation-State Machine L = abaab 1 1 1 2 2 2 A A A a b a b a b • Example 2
Concatenation-State Machine. 1 L = a + (bb)*a b a 2 b A • Example 3
Concatenation-State Machine as a Compact Version of DSM L = {a25} 11001 • Relation to: • String compression • Common sub-expressions • in optimizing compilers 1 A A 1 • Example 4
Concatenation-State Machine. a 1 4 3 a a 2 b L = anbn b A b • Example 5
Executing a CSM. • Single-state (stateless) push-down automaton • Acts on the input symbol and the top-of-stack symbol • Each state of the CSM corresponds to a different stack symbol, but no symbol (or empty string) corresponds to the Accept state. • When starting the execution, the stack contains the symbol of the initial state of the CSM • For each switch state s of the CSM, its symbol is popped from the stack, input symbol i is read and a symbol of the transitions state tS(s,i) is pushed on the stack • For each concatenation state c of the CSM, its symbol is popped from the stack, and two symbols c1 and c2 corresponding to the state successors of c, (c1, c2) = tC(c) are pushed on the stack, c2 on the top (no input symbol is read) • The input string is accepted when it is completely read and the stack is empty
Executing a CSM. L = a + (bb)*a input stack b ba X < 1 X ba Y < b Y a ba Z X< 2 a X< Z < b A
Paths in a CSM. bbbba b L = a + (bb)*a bba 1 X b b b b Y a 1 1 2 2 1 2 1 1 2 Z b b a A A A A A A b a
Converting a CSM to a grammar. • Each state of the CSM, except the Accept state, corresponds to a different non-terminal symbol of the grammar. The Accept state corresponds to the empty string • The initial state of the CSM corresponds to the axiom of the grammar • For each transition tS (c1,i) = c2 a production rule C1 iC2 is added to the grammar, with c1, c2 corresponding to C1, C2 respectively • For each transition tC (c) = (c1, c2)a production rule CC1C2 is added to the grammar, with c, c1, c2 corresponding to C, C1, C2respectively
Converting a CSM to a grammar. Example 6 bbbba b X bY X a Y ZX Z b L = a + (bb)*a 1 X X bYbZXbbXbbbY bbbZXbbbbXbbbba By factorizing we get X bY X a Y bX b b b Y a 1 1 2 2 1 2 Z b A A A A b a
Converting a CSM to a grammar. Example 7 SaX S bB X aY XbC Y aZ Y b BCD C EZ D ZS E XZ SaX S bB X aY XbC Y aZ Y b BXZZZS C XZZ D ZS E XZ SaX S bB X aY XbC Y aZ Y b B aYZZZS B bCZZZS C aYZZ C bCZZ D bS E aYZ E bCZ S a b 1 2 4 B X a b 3 C Y D a A E Z b Deterministic Greibach Normal Form
Simple languages and CSMs. • Deterministic simple languages are generated by deterministic grammars in Greibach Normal Form • The class of deterministic simple languages is equivalent to the class of languages acceptable by Concatenation State Machines • The class of deterministic simple languages is acceptable by stateless pushdown deterministic automata
A CSM reading more than one input symbol per memory cycle. aaa baa aba 1 2 bb bbb aaa aa 3 4 5 a A b aab
Computing the throughput of a CSM. -1 3 3 3 +2 1 2 0 +2 2 3 3 2 5 4 3 0 +2 +1 1 -1 A 1 3