I am looking for a grammar or algorithm to write down what I now call 'metacompositions' (or just compositions of compositions? see https://oeis.org/A133494) of character strings with the absolute minimum of characters, without loosing any information.
I wrote an enumeration class in java that enumerates these objects but I can't seem to compress the notation to an absolute minimum; I'm convinced my code is not optimal in this sense.
If you're interested, here's my code: https://github.com/ncg777/name.ncg777/blob/main/src/name/ncg777/Maths/Enumerations/MetaCompositionEnumeration.java
Here is example output for the string "01234":
[[01234]]
[[0][1234]]
[[0]][[1234]]
[[01][234]]
[[01]][[234]]
[[0][1][234]]
[[0]][[1][234]]
[[0][1]][[234]]
[[0]][[1]][[234]]
[[012][34]]
[[012]][[34]]
[[0][12][34]]
[[0]][[12][34]]
[[0][12]][[34]]
[[0]][[12]][[34]]
[[01][2][34]]
[[01]][[2][34]]
[[01][2]][[34]]
[[01]][[2]][[34]]
[[0][1][2][34]]
[[0]][[1][2][34]]
[[0][1]][[2][34]]
[[0]][[1]][[2][34]]
[[0][1][2]][[34]]
[[0]][[1][2]][[34]]
[[0][1]][[2]][[34]]
[[0]][[1]][[2]][[34]]
[[0123][4]]
[[0123]][[4]]
[[0][123][4]]
[[0]][[123][4]]
[[0][123]][[4]]
[[0]][[123]][[4]]
[[01][23][4]]
[[01]][[23][4]]
[[01][23]][[4]]
[[01]][[23]][[4]]
[[0][1][23][4]]
[[0]][[1][23][4]]
[[0][1]][[23][4]]
[[0]][[1]][[23][4]]
[[0][1][23]][[4]]
[[0]][[1][23]][[4]]
[[0][1]][[23]][[4]]
[[0]][[1]][[23]][[4]]
[[012][3][4]]
[[012]][[3][4]]
[[012][3]][[4]]
[[012]][[3]][[4]]
[[0][12][3][4]]
[[0]][[12][3][4]]
[[0][12]][[3][4]]
[[0]][[12]][[3][4]]
[[0][12][3]][[4]]
[[0]][[12][3]][[4]]
[[0][12]][[3]][[4]]
[[0]][[12]][[3]][[4]]
[[01][2][3][4]]
[[01]][[2][3][4]]
[[01][2]][[3][4]]
[[01]][[2]][[3][4]]
[[01][2][3]][[4]]
[[01]][[2][3]][[4]]
[[01][2]][[3]][[4]]
[[01]][[2]][[3]][[4]]
[[0][1][2][3][4]]
[[0]][[1][2][3][4]]
[[0][1]][[2][3][4]]
[[0]][[1]][[2][3][4]]
[[0][1][2]][[3][4]]
[[0]][[1][2]][[3][4]]
[[0][1]][[2]][[3][4]]
[[0]][[1]][[2]][[3][4]]
[[0][1][2][3]][[4]]
[[0]][[1][2][3]][[4]]
[[0][1]][[2][3]][[4]]
[[0]][[1]][[2][3]][[4]]
[[0][1][2]][[3]][[4]]
[[0]][[1][2]][[3]][[4]]
[[0][1]][[2]][[3]][[4]]
[[0]][[1]][[2]][[3]][[4]]
I'm convinced there is a better notation for these objects. Imagine then feeding back the output of the program into itself; both the input and the output are strings.
UPDATE: I think I fixed my problem with a simple regex. Here is the new output for "01234" with parenthesizations that are not necessarily balanced.
<01234>
<0<1234>
<0><1234>
<01<234>
<01><234>
<0<1<234>
<0><1<234>
<0<1><234>
<0><1><234>
<012<34>
<012><34>
<0<12<34>
<0><12<34>
<0<12><34>
<0><12><34>
<01<2<34>
<01><2<34>
<01<2><34>
<01><2><34>
<0<1<2<34>
<0><1<2<34>
<0<1><2<34>
<0><1><2<34>
<0<1<2><34>
<0><1<2><34>
<0<1><2><34>
<0><1><2><34>
<0123<4>
<0123><4>
<0<123<4>
<0><123<4>
<0<123><4>
<0><123><4>
<01<23<4>
<01><23<4>
<01<23><4>
<01><23><4>
<0<1<23<4>
<0><1<23<4>
<0<1><23<4>
<0><1><23<4>
<0<1<23><4>
<0><1<23><4>
<0<1><23><4>
<0><1><23><4>
<012<3<4>
<012><3<4>
<012<3><4>
<012><3><4>
<0<12<3<4>
<0><12<3<4>
<0<12><3<4>
<0><12><3<4>
<0<12<3><4>
<0><12<3><4>
<0<12><3><4>
<0><12><3><4>
<01<2<3<4>
<01><2<3<4>
<01<2><3<4>
<01><2><3<4>
<01<2<3><4>
<01><2<3><4>
<01<2><3><4>
<01><2><3><4>
<0<1<2<3<4>
<0><1<2<3<4>
<0<1><2<3<4>
<0><1><2<3<4>
<0<1<2><3<4>
<0><1<2><3<4>
<0<1><2><3<4>
<0><1><2><3<4>
<0<1<2<3><4>
<0><1<2<3><4>
<0<1><2<3><4>
<0><1><2<3><4>
<0<1<2><3><4>
<0><1<2><3><4>
<0<1><2><3><4>
<0><1><2><3><4>
UPDATE 2: I did have some regex for the language, here with parentheses instead of brackets:
\([^()]*\(*[^()]*\(*[^()]*\)
I guess it could be easy to use a similar expression to enumerate these.