After seeing some debate about whether or not Walt was punished enough by the end of Breaking Bad, and so I thought I'd throw out a few predecessors from literature, to at least clarify what kind of story that Vince Gilligan was telling. I believe, in the end, that it was a "be careful what you wish for, because you might just get it" story, a myth that tends to echo through many cultures and ages. Here's some examples.
The Greeks love a "be careful what you wish for" story, but this might be the most analogous to Walt. Midas is given a wish and asks that everything he touch be turned to gold. It's fun at first, but then he touches his daughter and kills her accidentally by turning her to gold.
Like Midas, Walt is having fun pulling the bucks in. In the end, however, the price he pays for all that gold is that his family has rejected him and he will never really know his daughter, who is still a baby when he dies.
Doctor Faustus is a brilliant scientist whose greed for more knowledge and power causes him to make a deal with the devil in exchange for these things. It's all fun and games, until the devil comes to claim his soul.
Walt is also a brilliant scientist, and the analogies I think are obvious enough. The final scene as Walt dies and the camera pulls away was highly reminiscent of some stagings of Faustus, where it ends with our mad scientist being pulled down into the bowels of hell.
A lot of people have paralleled Macbeth and Walt, particularly in the sense that Walt has been willing to kill already existing drug lords to be the drug kingpin of the Southwest. Unsurprisingly, like "Macbeth", Breaking Bad ends in a bloodbath that is underpinned by a sense of regret.
One thing that really struck me was that look of peace and resignation on Walt's face as he dies. As I note in the post below, I took it to mean that he has finally come to terms with the fact that everything that he did has meant nothing, and that his grand schemes to be someone important have turned to dust in his mouth. I was reminded of Macbeth's famous speech when he has the same realization: