Now it isn't possible. But if you create a language, corresponding to C+, and text generation layer for C+, it will be possible. In short you should do following things:
1. Create a C++ corresponding language in the MPS.
2. For each its concept create a class ConceptName_TextGen, derived from jetbrains.mps.textGen.SNodeTextGen;.Method names are quite straightforward, and it I hope it's possible to do without looking for example. If not, ask us, and we provide several examples.
Now it isn't possible. But if you create a language, corresponding to C+, and text generation layer for C+, it will be possible. In short you should do following things:
1. Create a C++ corresponding language in the MPS.
2. For each its concept create a class ConceptName_TextGen, derived from jetbrains.mps.textGen.SNodeTextGen;.Method names are quite straightforward, and it I hope it's possible to do without looking for example. If not, ask us, and we provide several examples.
May be stupid question :-)
Konstatin, could you explain what does "create a class ConceptName_TextGen, derived from jetbrains.mps.textGen.SNodeTextGen" mean ?
What should I do to create it ?
take a look at this discussion
http://www.intellij.net/forums/thread.jspa?threadID=264893&tstart=0
you will find the complete example of simple 'target' language.
igor.
OK. Thank you!
But now I've got another problem with generators :-)
- I create concept of target language and mark it with one property macro
- Then I create mapping rule, write source query. Everything is still OK
- But when I try to select template, I press Ctrl+Space, select template but then I get such error messages:
* ERROR - s.ide.command.CommandProcessor - Exception during executing command Unnamed
java.lang.RuntimeException: Couldn't set referent node: SimpleFunction [1167208921925] in sourceLang.gen
erator.targetLang.template.main@templates
at jetbrains.mps.smodel.action.DefaultReferentNodeSubstituteAction.doSubstitute(DefaultReferentNodeSubstituteAct
ion.java:43)
at jetbrains.mps.nodeEditor.EditorUtil.substituteNode(EditorUtil.java:594)
at jetbrains.mps.nodeEditor.NodeSubstituteChooser.doSubstituteSelection(NodeSubstituteChooser.java:302)
at jetbrains.mps.nodeEditor.NodeSubstituteChooser.menu_processKeyPressed(NodeSubstituteChooser.java:291)
at jetbrains.mps.nodeEditor.NodeSubstituteChooser.processKeyPressed(NodeSubstituteChooser.java:225)
at jetbrains.mps.nodeEditor.AbstractEditorComponent$18.run(AbstractEditorComponent.java:1388)
at jetbrains.mps.ide.command.CommandProcessor.executeCommand_internal(CommandProcessor.java:85)
at jetbrains.mps.ide.command.CommandProcessor.executeCommand(CommandProcessor.java:71)
at jetbrains.mps.ide.command.CommandProcessor.executeCommand(CommandProcessor.java:56)
at jetbrains.mps.nodeEditor.AbstractEditorComponent.processKeyPressed(AbstractEditorComponent.java:1386)
at jetbrains.mps.nodeEditor.AbstractEditorComponent$10.keyPressed(AbstractEditorComponent.java:295)
at java.awt.AWTEventMulticaster.keyPressed(Unknown Source)
at java.awt.Component.processKeyEvent(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
What's wrong ?
Attachment(s):
project1.zip
I've remade everything. And now it's OK !
fine! thax for letting us know
hi derUser, i am also be interested in c++ code generation. would you be willing to share your development?