How to integrate script java language in my dsl for manipulate (filtering) nodes for generation

Hello, сolleagues!

I have a dsl language which generates the plain text. I want add java extension for filtering sequence nodes which I want print.

My difficult is that I can't add java code (closure literal) for my concept in generator and do $COPY_SRCL$ for replace body closureLiteral with my body of filter function.
How can I ivoke my conceptFunction body in $COPY_SRCL$ mapped function?

What can I do for this opportunity?


I am using MPS 2018.1.5


I read article

but it not work in my situation, because my dsl not compilled in Java/ my dsl generates in low level dsl.


Comment actions Permalink

The concept function implementation provided by you in the Macro has nothing to do with the output model language.
It is just baseLanguage or any other DSL you import in your Generator (by CTRL/CMD+L) to provide the functionality for your generator implementation.

Comment actions Permalink

Thanks for answer.

My problem is different.

For example:

1. I have Node with the children:

   - tasks[0..n] (concept Task)

  - filterFunction[0..1] (concept ConceptFunction that returned type sequence<node<>>)

2. In generator I do next:

   <TF $COPY_SRCL$[ This is sample task] TF>

In function macros $COPY_SRCL$ I want, but HOW??? (Attention: bold text is a pseudocode that I want to make work):


mapped nodes : (genContext, node, operationContext)->sequence<node<>> {
 node.filterFunction.Invoke(node.tasks)  <<<<<<----------------------------------------------------------I want to make work

Comment actions Permalink

So you would like the filterFunction to be interpreted at generation time?

Comment actions Permalink

Usually that would be quite time consuming because you needed an interpreter up and running that would interpret those node contents....
The idea behind the concept functions as far as I understood is more for adding a "method" to your generated code. In the case of the generator they are used to create a method in a java class that is then executed. There will be class called containing those generated macro functions which is finally executed, when the generator is invoked. So the node cannot deliver the compiled code I think.

Comment actions Permalink


And in my opinion most likely so



Please sign in to leave a comment.