CodeGenerator, your opinions?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
30 messages Options
12
Reply | Threaded
Open this post in threaded view
|

CodeGenerator, your opinions?

hernanmd
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

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

Julien Delplanque
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
>


Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

kilon.alios
In reply to this post by hernanmd
There is the CCodeGenerator , which is basically Slang, Smalltalk that is turned into basic C. I would like to expand it to generate C++ at some point for converting pharo code to C++ code that I will be able to add to Unreal. Though its a very low priority project for me.

http://smalltalkhub.com/#!/~PavelKrivanek/CCodeGenerator

Personally I am against generalized solutions because they tend to be bad for specialized cases , on the other hand I welcome any code that I can use as inspiration for my own code generator.

On Tue, Oct 18, 2016 at 8:25 AM Hernán Morales Durand <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

otto
In reply to this post by Julien Delplanque
+1 for the visitor. What would be nice is to generate methods in the
form #visit<Class Name>: for all classes in a given hierarchy (eg
Magritte's MAVisitor). The default implementation of such a method
would be to call #visit<My Super Class name>:

We have been using state machines for a long time and have built
generators for it (on a previous project, for which I do not have the
code). I still think that is a useful idea. It is difficult for the
code generator to maintain changes in the generated code with changes
in the "spec". Will you then define a DSL for the state machine?

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
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

Thierry Goubier
Hi Otto,

for things like that, I would consider looking into the SmaCC visitor
automatic generation. From an grammar, SmaCC creates the class,
respecting an eventual inheritance constraint you specify, adds the
instance variables, and generates the visitor (and an equality test too).

Regarding state machines generation, what class of automatons are you
looking at? Because I'm looking at automatons generation by reusing
SmaCC (for a tentative hardware architecture subject).

Regards,

Thierry

Le 18/10/2016 à 10:01, Otto Behrens a écrit :

> +1 for the visitor. What would be nice is to generate methods in the
> form #visit<Class Name>: for all classes in a given hierarchy (eg
> Magritte's MAVisitor). The default implementation of such a method
> would be to call #visit<My Super Class name>:
>
> We have been using state machines for a long time and have built
> generators for it (on a previous project, for which I do not have the
> code). I still think that is a useful idea. It is difficult for the
> code generator to maintain changes in the generated code with changes
> in the "spec". Will you then define a DSL for the state machine?
>
> 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
>>>
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

Peter Uhnak
In reply to this post by hernanmd
Hi Hernan,

I wrote some time ago two basic code generators (both in Pharo) from UML-ified FAMIX for a particular user (so there are some domain-specific patterns),
one for Pharo syntax ( https://github.com/OpenPonk/class-editor/blob/master/docs/code-generation/uml-to-code.md )
and one for VW syntax ( https://github.com/OpenPonk/class-editor/blob/master/docs/vw-code-generation/pim-psm.md )

(the code is here https://github.com/OpenPonk/class-editor/tree/master/repository/DynaCASE-Generator.package and here  https://github.com/OpenPonk/class-editor/tree/master/repository/UML-CodeGenerator.package )

The most pain I had was with expressing templateable code to which I could just plug specific data, I wanted to look at QVT but didn't have the time yet.
But it would be interesting to see if your generator could address such issues; plus soon I want to iterate on my generators to have more live interaction (so the code is generated on the fly as the model is created, although I am using Pharo Refactoring engine for now, which is also quite powerful.)

Addionally, Lionel (in cc) is working on some meta system generating classes with magritte descriptions.

So it would be cool if we could have some really cool generator that could do many cool things. :)

Peter

On Tue, Oct 18, 2016 at 02:24:28AM -0300, 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

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

Peter Uhnak
In reply to this post by hernanmd
On Tue, Oct 18, 2016 at 02:24:28AM -0300, Hernán Morales Durand wrote:
> - A Spec UI generator.

Oh, and Stephan did CRUD(e) Spec generator http://forum.world.st/ANN-SpecGenerator-easy-CRUD-applications-with-Spec-td4889624.html

Peter

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

lionelakue
In reply to this post by Peter Uhnak
Great!

We had the same idea :)

The first requirements I wrote was  to generate Spec UI directly. But I rather chose to make Magritte compatible with Spec.

So from the Magritte description, we could generate Spec, Seaside ...

Lionel

2016-10-18 14:20 GMT+02:00 Peter Uhnak <[hidden email]>:
Hi Hernan,

I wrote some time ago two basic code generators (both in Pharo) from UML-ified FAMIX for a particular user (so there are some domain-specific patterns),
one for Pharo syntax ( https://github.com/OpenPonk/class-editor/blob/master/docs/code-generation/uml-to-code.md )
and one for VW syntax ( https://github.com/OpenPonk/class-editor/blob/master/docs/vw-code-generation/pim-psm.md )

(the code is here https://github.com/OpenPonk/class-editor/tree/master/repository/DynaCASE-Generator.package and here  https://github.com/OpenPonk/class-editor/tree/master/repository/UML-CodeGenerator.package )

The most pain I had was with expressing templateable code to which I could just plug specific data, I wanted to look at QVT but didn't have the time yet.
But it would be interesting to see if your generator could address such issues; plus soon I want to iterate on my generators to have more live interaction (so the code is generated on the fly as the model is created, although I am using Pharo Refactoring engine for now, which is also quite powerful.)

Addionally, Lionel (in cc) is working on some meta system generating classes with magritte descriptions.

So it would be cool if we could have some really cool generator that could do many cool things. :)

Peter

On Tue, Oct 18, 2016 at 02:24:28AM -0300, 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

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

otto
In reply to this post by Thierry Goubier
> for things like that, I would consider looking into the SmaCC visitor
> automatic generation. From an grammar, SmaCC creates the class, respecting
> an eventual inheritance constraint you specify, adds the instance variables,
> and generates the visitor (and an equality test too).

Nice. Will have a look. Thanks.

> Regarding state machines generation, what class of automatons are you
> looking at? Because I'm looking at automatons generation by reusing SmaCC
> (for a tentative hardware architecture subject).

We have some domain specific objects, for example investment
instructions, that go through some domain specific state transitions.
It is not enormous, but a state transition model helps to understand
what valid transitions there are. As a simplistic example, when we
receive an investment instruction, one user "submits" the instruction,
another "authorises". From there it moves into a processing state and
then complete when the investment is placed.

What will be nice is to set up guards on transitions, entry / exit
actions and more nice things that can be done with a state machine.
Reading the state machine then gives a nice overview of the logic.
What will be nice is to see that in the form of a graph, with all the
annotations.

We do not currently use complexities like concurrency and nesting, but
have seen that working before.

Does this answer what you're asking?

>
> Regards,
>
> Thierry
>
>
> Le 18/10/2016 à 10:01, Otto Behrens a écrit :
>>
>> +1 for the visitor. What would be nice is to generate methods in the
>> form #visit<Class Name>: for all classes in a given hierarchy (eg
>> Magritte's MAVisitor). The default implementation of such a method
>> would be to call #visit<My Super Class name>:
>>
>> We have been using state machines for a long time and have built
>> generators for it (on a previous project, for which I do not have the
>> code). I still think that is a useful idea. It is difficult for the
>> code generator to maintain changes in the generated code with changes
>> in the "spec". Will you then define a DSL for the state machine?
>>
>> 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
>>>>
>>>
>>>
>>
>>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

hernanmd
In reply to this post by kilon.alios
Hi Dimitris,

That would be certainly nice. C++ is hard, but if one start with a basic instantiation template it could be easier to move forward to more complex tasks like mapping data structures to STL, their containers and iterators. And I think it would attract C++ developers to Smalltalk.
Cheers,

Hernán


2016-10-18 4:54 GMT-03:00 Dimitris Chloupis <[hidden email]>:
There is the CCodeGenerator , which is basically Slang, Smalltalk that is turned into basic C. I would like to expand it to generate C++ at some point for converting pharo code to C++ code that I will be able to add to Unreal. Though its a very low priority project for me.

http://smalltalkhub.com/#!/~PavelKrivanek/CCodeGenerator

Personally I am against generalized solutions because they tend to be bad for specialized cases , on the other hand I welcome any code that I can use as inspiration for my own code generator.

On Tue, Oct 18, 2016 at 8:25 AM Hernán Morales Durand <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

hernanmd
In reply to this post by otto
Hi Otto,

2016-10-18 5:01 GMT-03:00 Otto Behrens <[hidden email]>:
+1 for the visitor. What would be nice is to generate methods in the
form #visit<Class Name>: for all classes in a given hierarchy (eg
Magritte's MAVisitor). The default implementation of such a method
would be to call #visit<My Super Class name>:

We have been using state machines for a long time and have built
generators for it (on a previous project, for which I do not have the
code). I still think that is a useful idea. It is difficult for the
code generator to maintain changes in the generated code with changes
in the "spec". Will you then define a DSL for the state machine?


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?

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?

 
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
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

hernanmd
In reply to this post by lionelakue

2016-10-18 9:35 GMT-03:00 Lionel Akue <[hidden email]>:
Great!

We had the same idea :)


Let me know if we can join forces to speed uo things.
 
The first requirements I wrote was  to generate Spec UI directly. But I rather chose to make Magritte compatible with Spec.

So from the Magritte description, we could generate Spec, Seaside ...


The CodeGenerator I wrote already generates Magritte code. If you load it in Pharo 5

Gofer it
    smalltalkhubUser: 'hernan' project: 'CodeGenerator';
    configuration;
    loadDevelopment.

Have a look at the usage examples:

#exampleMagritteDescriptionCreation1
#exampleMagritteDescriptionCreation2
#exampleMagritteDescriptionCreation3

If you have suggestions I would like to read.

Hernán
 
Lionel

2016-10-18 14:20 GMT+02:00 Peter Uhnak <[hidden email]>:
Hi Hernan,

I wrote some time ago two basic code generators (both in Pharo) from UML-ified FAMIX for a particular user (so there are some domain-specific patterns),
one for Pharo syntax ( https://github.com/OpenPonk/class-editor/blob/master/docs/code-generation/uml-to-code.md )
and one for VW syntax ( https://github.com/OpenPonk/class-editor/blob/master/docs/vw-code-generation/pim-psm.md )

(the code is here https://github.com/OpenPonk/class-editor/tree/master/repository/DynaCASE-Generator.package and here  https://github.com/OpenPonk/class-editor/tree/master/repository/UML-CodeGenerator.package )

The most pain I had was with expressing templateable code to which I could just plug specific data, I wanted to look at QVT but didn't have the time yet.
But it would be interesting to see if your generator could address such issues; plus soon I want to iterate on my generators to have more live interaction (so the code is generated on the fly as the model is created, although I am using Pharo Refactoring engine for now, which is also quite powerful.)

Addionally, Lionel (in cc) is working on some meta system generating classes with magritte descriptions.

So it would be cool if we could have some really cool generator that could do many cool things. :)

Peter

On Tue, Oct 18, 2016 at 02:24:28AM -0300, 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


Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

tblanchard
In reply to this post by hernanmd
My personal feeling on code generators is they are a bad code smell and the desire to use them tends to imply that your programming language isn't dynamic enough.

That said I have used DNE on proto object proxies to capture messages sent and generate handlers (I have used this on Morphic to try to figure out what methods actually get called vs the ones that don't).

I have also used this sort of thing to build a model that matches a database schema.

But I wouldn't typically make code generation a routine part of my development process.

> On Oct 17, 2016, at 22:24, Hernán Morales Durand <[hidden email]> 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
>


Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

Evan Donahue
In reply to this post by hernanmd
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
Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

philippeback
In reply to this post by tblanchard

They are useful for writing VM plugins for example. The generic part.

On Tue, Oct 18, 2016 at 6:53 PM, Todd Blanchard <[hidden email]> wrote:
My personal feeling on code generators is they are a bad code smell and the desire to use them tends to imply that your programming language isn't dynamic enough.

That said I have used DNE on proto object proxies to capture messages sent and generate handlers (I have used this on Morphic to try to figure out what methods actually get called vs the ones that don't).

I have also used this sort of thing to build a model that matches a database schema.

But I wouldn't typically make code generation a routine part of my development process.

> On Oct 17, 2016, at 22:24, Hernán Morales Durand <[hidden email]> 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
>




Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

lionelakue
In reply to this post by hernanmd

Sure I will look and let you know.

Lionel


Le 18 oct. 2016 18:07, "Hernán Morales Durand" <[hidden email]> a écrit :

2016-10-18 9:35 GMT-03:00 Lionel Akue <[hidden email]>:
Great!

We had the same idea :)


Let me know if we can join forces to speed uo things.
 
The first requirements I wrote was  to generate Spec UI directly. But I rather chose to make Magritte compatible with Spec.

So from the Magritte description, we could generate Spec, Seaside ...


The CodeGenerator I wrote already generates Magritte code. If you load it in Pharo 5

Gofer it
    smalltalkhubUser: 'hernan' project: 'CodeGenerator';
    configuration;
    loadDevelopment.

Have a look at the usage examples:

#exampleMagritteDescriptionCreation1
#exampleMagritteDescriptionCreation2
#exampleMagritteDescriptionCreation3

If you have suggestions I would like to read.

Hernán
 
Lionel

2016-10-18 14:20 GMT+02:00 Peter Uhnak <[hidden email]>:
Hi Hernan,

I wrote some time ago two basic code generators (both in Pharo) from UML-ified FAMIX for a particular user (so there are some domain-specific patterns),
one for Pharo syntax ( https://github.com/OpenPonk/class-editor/blob/master/docs/code-generation/uml-to-code.md )
and one for VW syntax ( https://github.com/OpenPonk/class-editor/blob/master/docs/vw-code-generation/pim-psm.md )

(the code is here https://github.com/OpenPonk/class-editor/tree/master/repository/DynaCASE-Generator.package and here  https://github.com/OpenPonk/class-editor/tree/master/repository/UML-CodeGenerator.package )

The most pain I had was with expressing templateable code to which I could just plug specific data, I wanted to look at QVT but didn't have the time yet.
But it would be interesting to see if your generator could address such issues; plus soon I want to iterate on my generators to have more live interaction (so the code is generated on the fly as the model is created, although I am using Pharo Refactoring engine for now, which is also quite powerful.)

Addionally, Lionel (in cc) is working on some meta system generating classes with magritte descriptions.

So it would be cool if we could have some really cool generator that could do many cool things. :)

Peter

On Tue, Oct 18, 2016 at 02:24:28AM -0300, 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


Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

vonbecmann
In reply to this post by hernanmd
Implementing State Machines in Smalltalk (1993) Trevor Hopkins
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.31.6732

- A state machine generator (based in the excellent paper of Trevor P. Hopkins)


i add it to my reading list. thanks


--
Bernardo E.C.

Sent from a cheap desktop computer in South America.
Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

philippeback
http://www.micro-workflow.com/PDF/wecfo.pdf seemed interesting.

Not state machines per se but still.


Phil

On Tue, Oct 18, 2016 at 8:47 PM, Bernardo Ezequiel Contreras <[hidden email]> wrote:
Implementing State Machines in Smalltalk (1993) Trevor Hopkins
http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.31.6732

- A state machine generator (based in the excellent paper of Trevor P. Hopkins)


i add it to my reading list. thanks


--
Bernardo E.C.

Sent from a cheap desktop computer in South America.

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

Thierry Goubier
In reply to this post by otto
Le 18/10/2016 à 15:45, Otto Behrens a écrit :
>> for things like that, I would consider looking into the SmaCC visitor
>> automatic generation. From an grammar, SmaCC creates the class, respecting
>> an eventual inheritance constraint you specify, adds the instance variables,
>> and generates the visitor (and an equality test too).
>
> Nice. Will have a look. Thanks.

The thing is basically SmaCC is a automaton compiler, with two different
generation strategies based on the type of automaton you are interested in.

Plus a tree / visitor generation code.

>> Regarding state machines generation, what class of automatons are you
>> looking at? Because I'm looking at automatons generation by reusing SmaCC
>> (for a tentative hardware architecture subject).
>
> We have some domain specific objects, for example investment
> instructions, that go through some domain specific state transitions.
> It is not enormous, but a state transition model helps to understand
> what valid transitions there are. As a simplistic example, when we
> receive an investment instruction, one user "submits" the instruction,
> another "authorises". From there it moves into a processing state and
> then complete when the investment is placed.
>
> What will be nice is to set up guards on transitions, entry / exit
> actions and more nice things that can be done with a state machine.
> Reading the state machine then gives a nice overview of the logic.
> What will be nice is to see that in the form of a graph, with all the
> annotations.

> We do not currently use complexities like concurrency and nesting, but
> have seen that working before.
>
> Does this answer what you're asking?

Yes, I think I understand, including the need for a graphical
representation.

I'm interested in finding opportunities for automata as a way to compute
(and synthesize hardware). I've seen very interesting results with
synthesis of automata co-processors on FPGAs (and the Micron Automata
processor as well). I suggested an internship in my lab, and it was
bumped up to a possible post-doc opportunity.

But I'm more into expressing them as a RE / as a Grammar than
explicitely... studying a way to convert between the different
representations could be interesting.

Thierry

Reply | Threaded
Open this post in threaded view
|

Re: CodeGenerator, your opinions?

tblanchard
In reply to this post by philippeback
Yes, this is another one and I would like to see a nice interface to clang that then generated all the glue code for a given library based on its public header files.

Smalltalk Agents used to do something like this.  You could point it at a library and it would open it and generate Smalltalk bindings to everything the library exported.

Ben has been blogging about experiments with just this, I'm kind of following along in his footsteps.  Being able to import pretty much any library with a few clicks and use it from Pharo would go a long way towards making it attractive for real development.  It seems rather silly we are doing all this painstaking work to keep database drivers and such up to date when we might be able to automate the bulk of it.

> On Oct 18, 2016, at 10:38, [hidden email] wrote:
>
>
> They are useful for writing VM plugins for example. The generic part.


12