There's a site out there that has a customized query language that can be passed along like this:
o:target o:creature (r:mythic or r:rare) t:"artifact creature"
Now, I know I could use a rather complicated regex to parse a similar file of code... but there may be as many as fifty different ways of querying, and that's gonna get ridiculously bad when people use, say, nested parentheses to search for things.
So: is there a PHP library that parses such strings automatically? Or is there a best practice for parsing potentially complex things like this? (I'm finding YAML, which seems complex, but that may be the answer.)