Instantly share code, notes, and snippets.

# pepijnkokke/anbn.inputLast active Mar 14, 2016

Grammars for aⁿbⁿ and aⁿbⁿcⁿ using constraint grammar (using only REMOVE).
 "" "a" "b" "opt_a" "opt_b" "odd" "even" "^" "\$" "" "a" "b" "opt_a" "opt_b" "odd" "even" "^" "\$" "" "a" "b" "opt_a" "opt_b" "odd" "even" "^" "\$" "" "a" "b" "opt_a" "opt_b" "odd" "even" "^" "\$" "" "a" "b" "opt_a" "opt_b" "odd" "even" "^" "\$" "" "a" "b" "opt_a" "opt_b" "odd" "even" "^" "\$" "<.>"
 DELIMITERS = "<.>" ; LIST A = "a" ; LIST B = "b" ; LIST OPT_A = "opt_a" ; LIST OPT_B = "opt_b" ; LIST ODD = "odd" ; LIST EVEN = "even" ; LIST >>> = "^" ; LIST <<< = "\$" ; SET ANY = A OR B ; # create own magic tags BEFORE-SECTIONS REMOVE >>> (-1 ANY) REMOVE <<< ( 1 ANY) # mark even/odd cohorts BEFORE-SECTIONS REMOVE EVEN (0 >>>) SECTION REMOVE ODD (NOT 0 >>> LINK NOT -1 EVEN) REMOVE EVEN (NOT -1 ODD) AFTER-SECTIONS REMCOHORT ANY (1* <<< LINK NOT 0 EVEN) REMCOHORT <<< (NOT 0 EVEN) # mark a/b BEFORE-SECTIONS SELECT A (0 >>>) SELECT B (0 <<<) SECTION REMOVE OPT_B (-1C A) REMOVE OPT_A ( 1C B) SELECT A (NOT 0 OPT_B) SELECT B (NOT 0 OPT_A)
 "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "" "a" "b" "c" "opt_a" "opt_b" "opt_c" "x1" "x2" "x3" "^" "\$" "fst" "snd" "opt_fst" "opt_snd" "<.>"