I used to be able to do something similar on my Sharp Zaurus SL5500 with the stock rom: there were various interpreters and compilers available for it and the built-in keyboard had mappings for the needed characters so I could write small programs and then compile and run them right on the device.