Re: Pattern Matching

//char expr [] = "[a,[b,c]]";
/*
success
(0, (1, 2))
(1, (a, 6, 6))
(2, (3, 4))
(3, (b, 5, 5))
(4, (c, 5, 5))
(5, (6, 6))
(6, (0, 0))
(7, (0, 0))
*/

//char expr [] = "[a,b]";
/*
success
(0, (1, 2))
(1, (a, 3, 3))
(2, (b, 3, 3))
(3, (0, 0))
(4, (0, 0))

*/
//char expr [] = "[a,[b,c]]";
/*
success
(0, (1, 2))
(1, (a, 6, 6))
(2, (3, 4))
(3, (b, 5, 5))
(4, (c, 5, 5))
(5, (6, 6))
(6, (0, 0))
(7, (0, 0))
*/
//char expr [] = "[[a,b],c]";
/*
success
(0, (1, 5))
(1, (2, 3))
(2, (a, 4, 4))
(3, (b, 4, 4))
(4, (6, 6))
(5, (c, 6, 6))
(6, (0, 0))
(7, (0, 0))
*/
//char expr [] = "[[a,b],[c,d]]";
/*
success
(0, (1, 5))
(1, (2, 3))
(2, (a, 4, 4))
(3, (b, 4, 4))
(4, (9, 9))
(5, (6, 7))
(6, (c, 8, 8))
(7, (d, 8, 8))
(8, (9, 9))
(9, (0, 0))
(10, (0, 0))
*/
//[a,b,c,d]
//char expr [] = "[a,[b,[c,d]]]";
/*
success
(0, (1, 2))
(1, (a, 9, 9))
(2, (3, 4))
(3, (b, 8, 8))
(4, (5, 6))
(5, (c, 7, 7))
(6, (d, 7, 7))
(7, (8, 8))
(8, (9, 9))
(9, (0, 0))
(10, (0, 0))
*/
//char expr [] = "[a,[[b,c],d]]";
/*
success
(0, (1, 2))
(1, (a, 9, 9))
(2, (3, 7))
(3, (4, 5))
(4, (b, 6, 6))
(5, (c, 6, 6))
(6, (8, 8))
(7, (d, 8, 8))
(8, (9, 9))
(9, (0, 0))
(10, (0, 0))

*/
//char expr [] = "[[[a,b],c],d]";
/*
success
(0, (1, 8))
(1, (2, 6))
(2, (3, 4))
(3, (a, 5, 5))
(4, (b, 5, 5))
(5, (7, 7))
(6, (c, 7, 7))
(7, (9, 9))
(8, (d, 9, 9))
(9, (0, 0))
(10, (0, 0))
*/

//char expr [] = "[[a,b],[c,[d,e]]]";
/*
success
(0, (1, 5))
(1, (2, 3))
(2, (a, 4, 4))
(3, (b, 4, 4))
(4, (12, 12))
(5, (6, 7))
(6, (c, 11, 11))
(7, (8, 9))
(8, (d, 10, 10))
(9, (e, 10, 10))
(10, (11, 11))
(11, (12, 12))
(12, (0, 0))
(13, (0, 0))
*/
//char expr [] = "[[a,b],[[c,d],e]]";
/*
success
(0, (1, 5))
(1, (2, 3))
(2, (a, 4, 4))
(3, (b, 4, 4))
(4, (12, 12))
(5, (6, 10))
(6, (7, 8))
(7, (c, 9, 9))
(8, (d, 9, 9))
(9, (11, 11))
(10, (e, 11, 11))
(11, (12, 12))
(12, (0, 0))
(13, (0, 0))
*/
//char expr [] = "[[a,b],[c,[d,e]]]";
/*
success
(0, (1, 5))
(1, (2, 3))
(2, (a, 4, 4))
(3, (b, 4, 4))
(4, (12, 12))
(5, (6, 7))
(6, (c, 11, 11))
(7, (8, 9))
(8, (d, 10, 10))
(9, (e, 10, 10))
(10, (11, 11))
(11, (12, 12))
(12, (0, 0))
(13, (0, 0))
*/
char expr [] = "[[[a,b],c],[d,e]]";
/*
success
(0, (1, 8))
(1, (2, 6))
(2, (3, 4))
(3, (a, 5, 5))
(4, (b, 5, 5))
(5, (7, 7))
(6, (c, 7, 7))
(7, (12, 12))
(8, (9, 10))
(9, (d, 11, 11))
(10, (e, 11, 11))
(11, (12, 12))
(12, (0, 0))
(13, (0, 0))
*/