|
|
|
|
|
by danielparks
495 days 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
|
|
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).