I have a python library that allows me to define rules by chaining inputs and outputs of functions ( producer(grep(count( [print(),log() ] )))
This functions define a pipeline from left to right.
How could I allow users to define pipelines from a UI ?
I need to take a definition like for example “producer->grep->count->print,log” and interpret it so as to call the former code.
Do i need a parser? an AST ? What would be a good way to build the call sequence fron a representation of the code?
7
It really depends on the intended audience:
-
Are they programmers themselves or not? If they are, then providing an API will be the easy way. You can also provide a DSL, but be wary that specifying and implementing a language might not be a trivial task and you can’t actually go and change the syntax at every release. Bending the syntax of a programming language into a DSL might or might not work and, most importantly, might add uneeded complexity.
-
Are they accustomed to writing batch scripts or not? If they aren’t, then you can forget a DSL, unless they are asking for it.
You don’t actually know? What about some visual block programming backed by an API in your scripting language of choice? You could try Google Blocky:
2