-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sprotty-vscode tranform confused #377
Comments
It's the other way around: the right part (diagram) is generated from the left part (DSL text). The code for this transformation is here: |
so if i need to achieve my requirement #375 ,to tranform industrial Programming Language LD(Ladder Diagram) to other specific lauguage like C++ or PLC ST (Structured Text)language,LD is similar to right part,C++ or PLC ST (Structured Text)language is similar to left part,i am considering define .langium extesion file to generate left part code template ,or do i have to write left part code by myself |
Langium can be used to create a parser and a language server for your ST language. Serializing text from another format is also on the roadmap, but currently not supported. So you need to generate the text with normal JavaScript / TypeScript templates. |
can not clealy catch your meaning ,what do you mean by saying "Serializing text from another format",Serializing text means ST language? is my requirements currently can not be achieved by sprotty and langium? |
Yes you can use Sprotty and Langium for those things. The only step that is currently not done automatically is to generate ST text from a diagram, you would need to implement that yourself. Langium has nice APIs to generate text: https://www.typefox.io/blog/code-generation-for-langium-based-dsls |
i have seen laugium example like domainmodel or statemachine,also see sprotty document and example ,i probably knows how they works,take domainmodel as an example ,it firstly define a custom language with extension .domainmodel,then generate ast code by langium-cli,then use cli to generate java code with the help of generated ast code ,so if i need to achieve this requirement,i am thinking define a custom lauguage like extension .aaa,i write aaa.langium grammar related to LD language logic(#375 ) ,then generate ast code by langium-cli,then i write example.aaa ,corresponding diagram is generated by extends LangiumDiagramGenerator,then i use cli to generate ST code by using generated ast code,is my idea correct? |
LD is a graphical language. What format are you using to persist it? If it's a custom text language, you can use Langium to parse that and then generate other formats like ST or C++. But if you use XML or JSON, you don't need Langium; just use plain TypeScript or some template library in that case. |
the demo example https://github.com/eclipse-sprotty/sprotty-vscode have MrsGrantsSecretCompartment.sm,i am a little confused how this file generated from corresponding diagram,that is to say how should right part tranform to left part ,i did not see any code related to it since my requirement is #375

The text was updated successfully, but these errors were encountered: