Generate TTCN-3 Code from Java [message #1779566] |
Tue, 09 January 2018 16:20 |
|
Hi *,
I would like to generate TTCN-3 code programmatically and preferably in Java. Unfortunately, this task is far from trivial.
I already tried to "abstract" TTCN-3 partially with POJOs and use the StringBuilder to generate the TTCN-3 code. IMHO this approach was quite simple in the beginning but appeared to be not feasible for more complex use cases.
So I moved on to ANTLR respectively Xtext, which seems to be the right way to go. Xtext utilizes ANTLR and builds a Lexer, Parser and Class Model for the AST and is even able to check the syntax and serialize the AST, exactly what I was looking for.
But describing the TTCN-3 grammar correctly in Xtext is even further from trivial. At least for me, as I don't have any experience with context-free grammars.
The next idea was to utilize Titan's code base for this task. Notably xsdconvert and titan.EclipsePlug-ins codegenerator seem to be promising. But I couldn't figure out whether the codegenerator is also able to produce TTCN-3 code or how I could utilize xsdconvert for this purpose.
Does anyone have any further ideas or suggestions?
Best regards,
Alexander
|
|
|
|
Re: Generate TTCN-3 Code from Java [message #1779620 is a reply to message #1779575] |
Wed, 10 January 2018 10:51 |
|
Hi Kristof,
thank you for your response.
Actually, I don't really need a compiler/lexer because I will only need to generate TTCN-3 code. During my investigation on that topic, I stumbled over Xtext, which claims to make language engineering easy and was curious about that. However, I underestimated the complexity of TTCN-3.
My current project is quite similar to xsd2ttcn and Elemer's example, but the target will be something like swagger2ttcn. Accordingly, my inputs are Swagger files which I want to translate to TTCN-3 Template Definitions.
Thank you for your advice. I will proceed with appending string approach for now.
Best Regards
Alexander
|
|
|
Powered by
FUDForum. Page generated in 0.03018 seconds