I want to build kind of a “template string” for la...
# announcements
t
I want to build kind of a “template string” for lay people (not that much) so they can receive an input (JSON) and create an output (also JSON) via web interface. Template example:
Copy code
{
   exampleArray: {{input.prices.filter(price -> price <= 100)}}
}
Any tips on how to build this kind of “template string”? Regex? Finite state transducer?
k
That almost looks like a small programming language simple smile. I'd tokenize it, actually parse it with recursive descent and then walk the tree to run it.
At least that's what I'd do if those expressions can get arbitrarily complicated.
You can also use a real scripting language instead, maybe embed python or Kotlin-script itself to run those pieces of code.