You can look at the browser and function objects in the manual to see what I talk about above.
A more advanced thing you could do is make your own parser that reads the editbox a character at a time to do your own coding language. This gives much more control or what can and can't be done by the user. This can be as complex or as simple as you like. Probably not easy if it's not something you've done before.
I've done some expression parsers before that you can find on the forum, but reading outside sources may be more useful.
I guess it depends on what you actually want the code to do specifically and look like specifically.