Tangle bracket language
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
A Tangle bracket language is a programming language where brackets can be "tangled," that is, written without being properly nested. In properly-nested brackets, the beginning and end of a "clause" of brackets must enclose a complete sequence. This means that these sequences are properly nested:
()
[]
{[]}
{()[]{}}
And these are not:
{[}]
{([{)}])
(([[)])]
An example of code written in an (ad-hoc) tangle-bracket language is:
while x {
if y [
doSomething();
}
doSomethingElse();
]
In this code, it is assumed that [...] and {...} can be used interchangeably, but not equivalently- head{body} and head{body} are equivalent, but head{body] and head[body} are not, since ] cannot close {.
Due to the confusing, headache-inducing nature of tangle-bracket grammar, no known practical programming languages invoke this convention. As such, the exact behavior of tangle-bracket code is not defined even by convention; however, one interpretation suggests that the above code (assuming there aren't any side effects of doSomething() or doSomethingElse()) may be equivalent to:
while(x && y) doSomething(); if(!x) doSomethingElse();