7 ms·
This is a matter of operator precedence and tokenization. Tokens are single characters in this language, and there is an invisible operator between them. If th
by danielparks 2y ago
This is a matter of operator precedence and tokenization. Tokens are single characters in this language, and there is an invisible operator between them.
If the operator were explicit (let’s call it ~), the example would look like this:
$ echo 'cat' | trre 'c:d~a:o~t:g'
dog
With unnecessary parentheses:
$ echo 'cat' | trre '(c:d)~(a:o)~(t:g)'
dog
- deleted 2y ago[deleted]
- c0nstantine 2y agoThat's true. Thank you for elaborating. There is a hidden operator of concatenation as for usual regular expressions. In the code I denote it as lower dot '.' (as in the old Thompson's implementation).