<no subject>
Hi everyone,
I mentioned in a previous thread that I am working on a toy-language as a learning-by-doing approach to MPS.
I would like to implement a generator that creates a Java function with n parameters.
My DSL allows the user to write something like
CLASS Name
FUNC Name1
PARAM P1:SomeTypeA
PARAM P2:SomeTypeB
FUNC Name2
<...>
The generated Java output should be something like
I already created a $LOOP$ to generate the function stubs. But how do I create the lists of parameters? Can I achieve this with the $LOOP$ macro as well? If yes, how do I get the comma in between parameters?
One additional question: The name of a function is derived by saying "Func" + node.name in the respective property macro. Let's assume I have to refer to those names in other places. Can I reference a name somehow? Please note that a $LOOP$ generates the functions and their names but I would like to refer to only one of those functions (for instance to simulate a call).
I mentioned in a previous thread that I am working on a toy-language as a learning-by-doing approach to MPS.
I would like to implement a generator that creates a Java function with n parameters.
My DSL allows the user to write something like
CLASS Name
FUNC Name1
PARAM P1:SomeTypeA
PARAM P2:SomeTypeB
FUNC Name2
<...>
The generated Java output should be something like
public static void FuncName1(SomeTypeA P1, SomeTypeB P2)
{}
public static void FuncName2()
{}
I already created a $LOOP$ to generate the function stubs. But how do I create the lists of parameters? Can I achieve this with the $LOOP$ macro as well? If yes, how do I get the comma in between parameters?
One additional question: The name of a function is derived by saying "Func" + node.name in the respective property macro. Let's assume I have to refer to those names in other places. Can I reference a name somehow? Please note that a $LOOP$ generates the functions and their names but I would like to refer to only one of those functions (for instance to simulate a call).
Please sign in to leave a comment.