Parser correctly recognizing recursive expressions and terms