Interpret a "custom code" using functions
===

I am trying to create an own code to allow a client to post something on a [pixel matrix][1].

Here an example of a code:
`15e3n:3;geo(386299n283752w):4;delta(16e3n:5;line(20e0n;20e10n;0e10n;color:d);19w55n;rectangle(50w50n;height:100;width:50));88e2n:randomColor()`

I want to interpret this using functions like in this case `geo`, `delta`, `line`, `rectangle`, `geo`, `randomColor`. The things that are written between `(`and `)`are the parameters, separated by a `;`. (`15e3n` is in this case a position "15 east, 3 north")

Example:
`function(param1:value1;param2:value2;value3;value4);function2(param1:value1)`

The functions should be executed and should replace the function with the result like here:

The text `16e13n:3;line(17e13n;19e13n;color:4);15e13n:3` should result in `16e13n:3;17e13n:4;18e13n:4;19e13n:4;15e13n:3`. Because the function `line` with params `17e13n;19e13n;color:4` have the result `17e13n:4;18e13n:4;19e13n:4;`that replaced the function in the input.

How can I achieve this? What is the best way? Regex?
Are there existing examples about how to do this?

Now, this looks a bit complicated :)

I thank you in advance for getting help on this!



  [1]: https://github.com/ffraenz/Paperchat