I would not hold my breath if I were you for 3 reasons
1) this idea will go through only if my direct bridge via shared memory between Pharo and Unreal fails are is proven very limited, which I highly doubt. 2) even if I proceed with it, I will certainly be specialised for Unreal and have little interest in covering C++, huge and ugly syntax. So it will probably be just a few steps further than CCodeGenerator than a full implementation. 3) I am interested in producing readable C++ code, which makes this project even harder long term though I could proceed with this anyway if I deem it useful under specific scenarios. To really make this tempting for C++ coders would need a full implementation. But in any case as I said, its very low priority for me, just a worse case scenario that I would try to avoid as much as I can. On Tue, Oct 18, 2016 at 6:03 PM Hernán Morales Durand <[hidden email]> wrote:
|
In reply to this post by hernanmd
> Do you mean internal or embedded DSL? I am open to write an DSL if
> facilitates the job, the thing with the Trevor's paper is that he defines 6 > implementations of FSM's (and in each implementation he considers several > issues leading to sub-implementations) so I would like a DSL which let me > express different implementations for the same FSM. Plus there are FSM > implementations out there: HotDraw, Connectors, MIDIInputParser, XMIReader, > SState, etc. I think a "correct" DSL would enable to define any of them > right? I just meant some syntactically terse way of expressing a state machine so that one can see the logic clearly. Representing a state machine in a graphical way is ideal. We did this once, but the problem is to make the state machine definition resilient to refactorings and changes to the code. What I mean is that compiling something into code is a one way thing; to keep it maintained, one would like to "reverse compile" and draw the state machine from code. A "correct" DSL would be something like a Harel state diagram, which should be able to express most requirements. I attach our state package, if you're interested. Not directly one of the approaches in Trevor's paper. Perhaps another option. I would like to extend it to use guards and actions and more. > The approach I am using now is a parametrized code generator, using > templates (not in the form of T4 templates), so it's a long way. > Maybe Helvetia could help? Out of my depth here; will have to read a lot more. > > >> >> On Tue, Oct 18, 2016 at 9:29 AM, Julien Delplanque <[hidden email]> >> wrote: >> > Hello, >> > >> > A generator for the visitor design pattern: >> > - Generate methods in visited objects: VisitedObject>>#accept: (with the >> > selector name configurable) >> > - Generate empty methods (or methods with a "self >> > subclassResponsability" if >> > an abstract visitor is generated) >> > called in #accept: methods of VisitedObjects in the Visitor i.e >> > Visitor>>#acceptVisitedObject: (with the selector >> > name configurable again). >> > >> > Each time this design pattern has to be used, it is annoying to write by >> > hand all these methods. >> > >> > Regards, >> > >> > Julien >> > >> > >> > On 18/10/16 07:24, Hernán Morales Durand wrote: >> >> >> >> Hi guys, >> >> >> >> I am writing a code generator, doing a few iterations right now. >> >> I want your opinion, which most useful thing would you like to be >> >> generated >> >> automatically? It could be a pattern, an idiom, another language... >> >> >> >> For example my own wish (roadmap) list: >> >> >> >> - A "settings framework" settings class generator. >> >> - A state machine generator (based in the excellent paper of Trevor P. >> >> Hopkins) >> >> - A Spec UI generator. >> >> >> >> Let me know your thoughts. >> >> >> >> Cheers, >> >> >> >> Hernán >> >> >> > >> > >> > Wonka-StateTransition-Core-otto.1645.mcz (5K) Download Attachment Wonka-StateTransition-Tests-Core-otto.4385.mcz (3K) Download Attachment |
Sorry, I see there are some unresolved dependencies on our code. Let
me know if I should work on that. On Wed, Oct 19, 2016 at 5:44 AM, Otto Behrens <[hidden email]> wrote: >> Do you mean internal or embedded DSL? I am open to write an DSL if >> facilitates the job, the thing with the Trevor's paper is that he defines 6 >> implementations of FSM's (and in each implementation he considers several >> issues leading to sub-implementations) so I would like a DSL which let me >> express different implementations for the same FSM. Plus there are FSM >> implementations out there: HotDraw, Connectors, MIDIInputParser, XMIReader, >> SState, etc. I think a "correct" DSL would enable to define any of them >> right? > > I just meant some syntactically terse way of expressing a state > machine so that one can see the logic clearly. Representing a state > machine in a graphical way is ideal. We did this once, but the problem > is to make the state machine definition resilient to refactorings and > changes to the code. What I mean is that compiling something into code > is a one way thing; to keep it maintained, one would like to "reverse > compile" and draw the state machine from code. > > A "correct" DSL would be something like a Harel state diagram, which > should be able to express most requirements. > > I attach our state package, if you're interested. Not directly one of > the approaches in Trevor's paper. Perhaps another option. I would like > to extend it to use guards and actions and more. > >> The approach I am using now is a parametrized code generator, using >> templates (not in the form of T4 templates), so it's a long way. >> Maybe Helvetia could help? > > Out of my depth here; will have to read a lot more. > >> >> >>> >>> On Tue, Oct 18, 2016 at 9:29 AM, Julien Delplanque <[hidden email]> >>> wrote: >>> > Hello, >>> > >>> > A generator for the visitor design pattern: >>> > - Generate methods in visited objects: VisitedObject>>#accept: (with the >>> > selector name configurable) >>> > - Generate empty methods (or methods with a "self >>> > subclassResponsability" if >>> > an abstract visitor is generated) >>> > called in #accept: methods of VisitedObjects in the Visitor i.e >>> > Visitor>>#acceptVisitedObject: (with the selector >>> > name configurable again). >>> > >>> > Each time this design pattern has to be used, it is annoying to write by >>> > hand all these methods. >>> > >>> > Regards, >>> > >>> > Julien >>> > >>> > >>> > On 18/10/16 07:24, Hernán Morales Durand wrote: >>> >> >>> >> Hi guys, >>> >> >>> >> I am writing a code generator, doing a few iterations right now. >>> >> I want your opinion, which most useful thing would you like to be >>> >> generated >>> >> automatically? It could be a pattern, an idiom, another language... >>> >> >>> >> For example my own wish (roadmap) list: >>> >> >>> >> - A "settings framework" settings class generator. >>> >> - A state machine generator (based in the excellent paper of Trevor P. >>> >> Hopkins) >>> >> - A Spec UI generator. >>> >> >>> >> Let me know your thoughts. >>> >> >>> >> Cheers, >>> >> >>> >> Hernán >>> >> >>> > >>> > >>> >> |
In reply to this post by otto
Sorry, I did not catch this thread before. If you are looking for a terse way to describe state machines, you may want to have a look at LRP, a live programming language for nested state machines (for robotics), implemented in Pharo. It seems to have what you are talking about in your mail. It is made for robotics, but in the end can be used for a lot more stuff since it has a clean integration with Pharo. The URL of LRP is http://pleiad.cl/LRP If you have any questions, feel free to ask! -- Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please see http://emailcharter.org . Johan Fabry - http://pleiad.cl/~jfabry PLEIAD and RyCh labs - Computer Science Department (DCC) - University of Chile > On 19 Oct 2016, at 00:44, Otto Behrens <[hidden email]> wrote: > > I just meant some syntactically terse way of expressing a state > machine so that one can see the logic clearly. Representing a state > machine in a graphical way is ideal. We did this once, but the problem > is to make the state machine definition resilient to refactorings and > changes to the code. What I mean is that compiling something into code > is a one way thing; to keep it maintained, one would like to "reverse > compile" and draw the state machine from code. > > A "correct" DSL would be something like a Harel state diagram, which > should be able to express most requirements. |
In reply to this post by hernanmd
Le 18/10/16 à 07:24, Hernán Morales Durand a écrit : > Hi guys, > > I am writing a code generator, doing a few iterations right now. > I want your opinion, which most useful thing would you like to be > generated automatically? It could be a pattern, an idiom, another > language... > > For example my own wish (roadmap) list: > > - A "settings framework" settings class generator. > - A state machine generator (based in the excellent paper of Trevor P. > Hopkins) > - A Spec UI generator. That one and a FAMIX Metamodel. Brice should build one so may be he can use yours and extend it. > > Let me know your thoughts. > > Cheers, > > Hernán > |
In reply to this post by hernanmd
Hernan What is the input you take to generate magritte? Lionel would like to have a kind of Crud on top of Pharo and it
would be good for business. Stef Le 18/10/16 à 18:07, Hernán Morales
Durand a écrit :
|
In reply to this post by Evan Donahue
Looks fun :)
Le 18/10/16 à 19:10, Evan Donahue a
écrit :
So this isn't a specific out-of-the-box solution to any of the code-generation use cases people have been discussing, but I thought it was relevant enough to toss it out there. I'm currently doing some work on program synthesis using a Pharo port of the miniKanren logic programming language (http://minikanren.org/). The Pharo version is here: http://smalltalkhub.com/#!/~EvanDonahue/SmallKanren . So far, I've only used it to implement this paper on generating scheme programs (http://smalltalkhub.com/#!/~EvanDonahue/SmallKanren), the implementation of which is here: http://smalltalkhub.com/#!/~EvanDonahue/Barliman . I've thought a bit about things like generating GUI's, and it seems like something interesting could be done there, since you could imagine feeding it constraints and then giving the results a thumbs up/thumbs down to see other satisfying layouts more or less like the ones you voted on, but the probabilistic learning component is an object of current research and isn't ready yet. I was planning on sending out an announcement once it was more complete and robust, as right now it has lots of tests but not much documentation, and the architecture is changing rapidly, per research requirements, but if anyone is interested in knowing more about it feel free to get in touch. This is part of a broader research program on intelligent interfaces, so hopefully some cooler things come out of it later down the line. Cheers, Evan |
In reply to this post by philippeback
would be nice to ask dragos his Smalltalk code :) Le 18/10/16 à 21:20, [hidden email]
a écrit :
|
In reply to this post by stepharo
Hi Stef
2016-10-19 17:29 GMT-03:00 stepharo <[hidden email]>:
Something like this: CGStMagritte uniqueInstance inputClass: ModelClass1; targetClass: ModelClass1; setBooleanAttributes: 'instVar1' label: 'label iVar1' priority: 10; setDateAndTimeAttributes: 'instVar2' label: 'label Date and Time' priority: 20; setDateAttributes: 'instVar3' label: 'label Date' priority: 30; setFileAttributes: 'iVarFile' label: 'label File' priority: 40; setMemoAttributes: 'iVarMemo' label: 'label Memo' priority: 50; setMultiOptionAttributes: 'iVarMultiOption' label: 'label Multi Option' priority: 60; setNumberAttributes: 'iVarInteger' label: 'label Integer' priority: 70; generateMethods. Smalltalk tools browser openOnClass: ModelClass1. self inform: 'Done'. which generates ModelClass1>>descriptionInstVar1 <magitteDescription> | tmp2 | tmp2 := MABooleanDescription new. tmp2 accessor: #instVar1; label: 'label iVar1'; priority: 10. ^ tmp2 yourself ModelClass1>>descriptionInstVar2 <magitteDescription> | tmp2 | tmp2 := MADateAndTimeDescription new. tmp2 accessor: #instVar2; label: 'label Date and Time'; priority: 20. ^ tmp2 yourself and so on.
Cool, hope he finds useful the code generator
|
In reply to this post by otto
Thank you Otto, I had a look and it seems a nice implementation (couldn't load into the image but using the Monticello Browser)2016-10-19 0:44 GMT-03:00 Otto Behrens <[hidden email]>: > Do you mean internal or embedded DSL? I am open to write an DSL if |
Free forum by Nabble | Edit this page |