I think there’s a subtle difference between charging everyone $100 per umbrella in a rain storm vs charging $100 for your last few umbrellas. Former is price gouging; latter is just economics.
Are you sure? Under a unified definition Uber’s surge pricing is an example of price gouging that hasn’t been legally addressed because it’s in response to supply-side shortage not demand-side need, allegedly anyway.
Morally, Uber should be allowed to charge whatever they want to. No one is forced to take an Uber.
But in practice Uber does face at least public scrutiny. Eg when there was a hostage situation in the Sydney city centre a few years ago, everyone wanted to leave and Uber's surge pricing kicked in automatically (no human at Uber even knew about the hostage situation, at least there was no human in the loop).
Of course, this was exactly working as intended, but it was a bad look, so Uber retroactively made all the fares out of the city centre free that day.
I wrote a library that takes a language specification (BNF, ABNF, etc) into a custom AST in Python. Then you can define a set of visitors for the custom AST to transform the tree into whatever you want. I implemented some checks integrated into the Python type system to type-check the visitors and I've used the library to do some non-trivial manipulations before.
It's mostly a pet project and I just wanted to share since it could maybe at least inspire something.