Wrap the core of the program in a method

This Pull request isn't as big as it looks, there are just a lot of indentation level changes. Add `?w=1` to the diff url to ignore the indent changes.


I wrapped the main part of the application in a `main` method that is called only if this is executed directly. This allows other python modules to import your code without it immediately running. I also put `speak` into a class with the `main` method becuase they were sharing state (`terminals` and `nonterminals`)

There is likely a better name for `Application` but I didn't know what to call it. If you suggest something, I will update the pull request.