Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: jarnold30 on July 06, 2022, 03:57:46 am

Title: can't generate code for a new language
Post by: jarnold30 on July 06, 2022, 03:57:46 am
Hi all.
I have created a new language (prolog) for code generation.
The elements I am trying to generate off are classes with stereotypes.
I have created stereotyped overrides using 'add new stereotypes override'.  I have set the language for each element to 'prolog'.
When I try to generate code, nothing happens.  No files are created.

What am I doing wrong?
Title: Re: can't generate code for a new language
Post by: qwerty on July 06, 2022, 07:12:17 am
Set aside that I would not use that strange macro stuff, what are your exact steps? Just "it does onot work" is not enough for debugging.

q.
Title: Re: can't generate code for a new language
Post by: jarnold30 on July 06, 2022, 07:22:33 am
When I select 'Generate', it claims success but no files are created.
I know that's not much to go on, but it's what I have.
John
Title: Re: can't generate code for a new language
Post by: Geert Bellekens on July 06, 2022, 02:36:28 pm
Did you actually create the code generation templates?

Geert
Title: Re: can't generate code for a new language
Post by: jarnold30 on July 06, 2022, 05:50:59 pm
I created a number of stereotype overrides
Title: Re: can't generate code for a new language
Post by: Geert Bellekens on July 06, 2022, 06:10:42 pm
I created a number of stereotype overrides
On the templates for which language?

IIRC you first have to define the templates for your language, and then change the templates to match your language.
You can use stereotype overrides, to differentiate between different type of classes within your language.

Geert
Title: Re: can't generate code for a new language
Post by: jarnold30 on July 07, 2022, 02:58:24 am
I don't understand what you mean.  I have defined some stereotype overrides, what more do I need to do?

Sorry, I'm definitely a noob at this
Title: Re: can't generate code for a new language
Post by: Geert Bellekens on July 07, 2022, 04:07:29 am
When you create the stereotype override, what do you see in the dropdown on the top that says "Language"?

Geert
Title: Re: can't generate code for a new language
Post by: jarnold30 on July 07, 2022, 05:51:06 am
It says 'prolog'
Title: Re: can't generate code for a new language
Post by: Sunshine on July 07, 2022, 10:29:07 am
You need to create templates to transform the model into Prolog otherwise you won't get any output.
This link explains about the code templates.
https://sparxsystems.com/enterprise_architect_user_guide/16.0/modeling_domains/codetemplates_2.html (https://sparxsystems.com/enterprise_architect_user_guide/16.0/modeling_domains/codetemplates_2.html)
Title: Re: can't generate code for a new language
Post by: jarnold30 on July 08, 2022, 01:21:44 am
Thanks.  I have read this doc, but it's still not clear to me what I need to do to actually generate code.  Are there any examples anywhere?
Title: Re: can't generate code for a new language
Post by: jarnold30 on July 08, 2022, 06:59:19 am
OK, I found out how it all works by looking at the java templates.  Phew!
Thanks for your help everyone