I've worked adjacent to the Brazilian tax code (I worked in multi-national manufacturing with a site in Brazil) and the reality is that it's full of hard-coded edge cases.
For reference, the US tax code is over 1m words (about 6000 printed pages), and the associated regulations, rulings and IRS guidance add about 75,000 pages more.