I could see it with a graphical programming language -- one where a FOR loop is a large box into which you'd drag other commands, where each variable and equation is an icon you drag out from the side. Almost like a physics flash game.
We mostly expected people to attach a bluetooth keyboard to their tablet or phone. For people who insisted on using a touch screen, we were working on a graphical context sensitive system like you describe -- except for existing languages (Objective-C)... because nobody wants to keep tapping semicolons and parenthesis :-)