--- replace: val: # - - m: '\{[^}]*\}' # r: "" - - m: "\ue001" r: "}" - - m: "\ue002" r: "\n" - - m: "\ue003" r: "\\\"" # parens: # - S: # '(': ['', 'O|1'] # ')': ['', 'F'] # default: [''] # end: '1' # 'O|': # '(': ['', 'O|<+(#0|1)>'] # ')': ['', '<=(#0|1|S|.(raw(C|)|+(#0|1)))>'] # default: [''] # end: '0' # 'C|': # ')': ['', '<=(#0|1|S|.(raw(C|)|+(#0|1)))>'] # default: ['', F] # end: '0' # F: # default: [''] # end: '0' # new syntax to bundle together some of the former top-level nodes and # enhance functionality without unduly increasing complexity. control: # this block already existed channels: val: "generated text" parens: "?" # prototype for file inclusion grammars: "recursive": "recursive.yml" # allows the creation of new transformers based on existing ones functions: double|: "<+(#0|#0)>" # cannot redefine existing names # len|: "<0>" # can refer to other user-defined functions triple|: "<+(double(#0)|#0)>" replace_demo: - val: # - - m: '\{[^}]*\}' # r: "" - - m: "\ue001" r: "}" - - m: "\ue002" r: "\n" - - m: "\ue003" r: "\\\"" # this causes t to be assigned the value of val after stage1 is applied. - t: - assign: "{val}" # Write all 'a's to channel 'a' - S: {} a: {a: [a]} # if no root is specified, use this default start: "{Dyck}" # Testing wordgen/cpp2. This should be treated as a normal node, because # replace is defined. replaceIPA: - val: "" example||: - val: "<.*(.({|#0|})|#1)>" word: - val: "a{word}" freq: "<*(10|/(1|#d))>" - val: "." test: - val: "{example|word|2}" Dyck: - val: "{Dyck:.8 1 1.2}{Dyck:.8 1 1.2}" - val: "[{Dyck:1 .8 1.1}]" - val: "" freq: .1 Dyck-2: - val: "{Dyck-2:.8 1 1.2}{Dyck-2:.8 1 1.2}" - val: "({Dyck-2:1 .8 1.1})" - val: "" freq: .1 balanced|: - val: "ERROR:[<0>]" freq: "" - val: "[<0>:]" freq: "" - val: "()[<0>:{balanced|}]" freq: "" - val: "([<0>:{balanced|}])" freq: "" - val: "[<0>:{balanced|}]()" freq: "" binPalindrome: - val: "" freq: .1 - val: "0" freq: .15 - val: "1" freq: .15 - val: "0{binPalindrome}0" - val: "1{binPalindrome}1" binary-to-unary|: - val: "" empty: - val: "" tstr-test: - val: "c: C: e: E: d: D: a:'' ...:'<...>' A:''" - val: "{empty}.{tstr-test}" tstr-test2: - val: ":" - val: ": {tstr-test2!0} {tstr-test2} {tstr-test2!0} :" freq: "" root: - val: '{|\{ref\}}' "|": - val: "<0>{or|a|b|c|d}" or|...: - val: "<0>" - val: "{or|<...>}" freq: "" ref: - val: "ref" kstar|: - val: "{optional|<0>}" - val: "<0>{kstar|<0>}" kstar|||: - val: "{optional|<0>}" freq: "<1>" - val: "<0>{kstar|<0>|<1>|<2>}" freq: "<2>" optional|: - val: "" - val: "<0>" repeat||: - val: "" freq: "" - val: "<1>" freq: "" - val: "<1>{repeat|<+(#0|-1)>|<1>}" freq: "" repeat.||: - val: "<.*(#0|#1)>" repeatn||: - val: "<.*(.({|#0|})|#1)>" test|: - val: "<=(#0|0|1|0)> <=(#0|1|1|0)> " prod|...: - val: "<*(#0|...)>" sum|...: - val: "<+(#0|...)>" math|...: - val: "" debug||...: - val: "<0>|<1>::<...>::" Node: - val: "{stext}:{Branches|0}" - val: "{stext}{ArgTag}:{Branches|1}" Branches|: - val: "{Branch!<0>}" - val: "{Branch!<0>}{Branches|<0>}" Branch: - val: "{br} - val: {valString|0}{ocs|0}" - val: "{br} - val: {valString|1}{ocs|1}" ocs|: - val: "" freq: 2 - val: "{br} {stext}: {ocString|<0>}{ocs|<0>}" freq: 4 - val: "{br} freq: {float}{ocs|<0>|}" freq: "" - val: "{br} freq: {ocString|1}{ocs|1|}" freq: "" ocs||: - val: "" - val: "{br} {stext}: {ocString|<0>}{ocs|<0>|}" ArgTag: - val: "|" - val: "|..." - val: "|{ArgTag}" valString|: - val: "\"{text|<0>}{valString2|<0>}\"" - val: "\"{NodeRef|<0>}{valString2|<0>}\"" valString2|: - val: "" - val: "{text|<0>}{valString2|<0>}" - val: "{NodeRef|<0>}{valString2|<0>}" ocString|: - val: "\"{text|<0>}\"" NodeRef|: - val: "{lbrace}{text|<0>}{args|<0>}{NRSuf|<0>}{rbrace}" args|: - val: "" - val: "|{text|<0>}{args|<0>}" NRSuf|: - val: "" - val: ":{flist|<0>}" - val: "!{ilist|<0>}" flist|: - val: "{float}" - val: "{float}{sep}{flist|<0>}" ilist|: - val: "{number}" - val: "{number}:{float}" - val: "{number}{sep}{ilist|<0>}" - val: "{number}:{float}{sep}{ilist|<0>}" ArgRef: - val: "{number}" - val: "{fun}({param}{params})" fun: - val: "{or|len|+|-|*|/|?|which|num|gt|lt|=|eq|.|.*|math|calc}" param: - val: "#{number}" - val: "..." - val: "{text|1}" params: - val: "" - val: "|{param}" - val: "|{param}{params}" text|: - val: "" - val: "{char|<0>}{text|<0>}" freq: 10 - val: "{ArgRef}{text|<0>}" freq: "" stext: - val: "" freq: 0 - val: "{char|0!0 1}{stext:1 0 10}" freq: 10 - val: "{char|0!0 1 2}{stext:1 0 10}" freq: 0 char|: - val: "{or|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z}" freq: 26 - val: "{or|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z}" freq: 26 - val: "{digit}" freq: 10 - val: "{or|/|.|,|@|$|%|^|&|*|?|\\|-|_|=|+|;|'|\ue003}" freq: 18 - val: "{or||}" freq: "" sep: - val: " " number: - val: "{digit}" - val: "{digit}{number}" float: - val: "{number}" - val: ".{number}" - val: "{number}.{number}" digit: - val: "{or|1|2|3|4|5|6|7|8|9|0}" lbrace: - val: "{{" rbrace: - val: "}}" br: - val: "\ue002" ior|...: - val: "<0>" ipa: "<0>" - val: "{or|<...>}" freq: "" ipa|: - ipa: "<0>" alpha: - val: "{or|a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z}" - val: "{or|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z}" # digit: # - val: "{or|1|2|3|4|5|6|7|8|9|0}" alnum: - val: "{alpha}" freq: 52 - val: "{digit}" freq: 10 tstring_first: - val: "{digit}{farg}" - val: ".{el1}" - val: "{alnum}{text}" freq: 62 tstring_begin: - val: "#{arg}" - val: "|" ipa: "|text" - val: ")" ipa: "|call_func" - val: "{alnum})" ipa: "|text|call_func" - val: ".{el1}" - val: "\\{escapetext}" # - val: ">" - val: "{alnum}{text}" freq: 62 text: - val: "\\{escapetext}" - val: "{alnum})" ipa: "|text|call_func" freq: 62 - val: "(" ipa: "|push_func" - val: "|" ipa: "|text" - val: "#{text_nofun}" - val: "{alnum}{text}" freq: 62 escapetext: - val: "{alnum}{text}" text_nofun: - val: "\\{escapetext_nofun}" escapetext_nofun: - val: "{alnum}{text_nofun}" arg: - ipa: "|arg" - val: "{digit}{arg}" freq: 10 - val: "{digit})" freq: 10 ipa: "|arg|call_func" - val: "{alpha})" freq: 62 ipa: "|sp_arg|call_func" - val: "{alpha}{sp_arg}" freq: 62 sp_arg: - val: "" - val: "" - val: "" - val: "" - val: "" - val: "" - val: "" - val: "" - val: "" - val: "" - val: "" - val: "" - val: "" - val: ""