What you are apparently trying to achieve is writing a new language. If I'm right then you gonna have to go through the following processus:
- Define a grammar that will recognize your language.
- Give this grammar to a tool like JS/CC (here, generating Javascript), SableCC (here, generating Java) or antlr (here, generating lots of languages), that will produce for you a parser.
- Then you will be able to implement the interpreter (or even a compiler if ever you need one) for your language based on what the parser generator will have given you.
I only used SableCC, which is a very powerful tool, and there are a lot of simple grammar examples in the archive proposed on the site that will possibly guide you.
Hope this helps.