[Pharo-dev] Parsing Pharo syntax to C/C++

phil at highoctane.be phil at highoctane.be
Mon Sep 15 08:02:21 EDT 2014


On Mon, Sep 15, 2014 at 1:39 PM, kilon alios <kilon.alios at gmail.com> wrote:

> WOW this CCodeGenerator is great , I have downloaded it and tried the
> example and it generated the 'generated.c" file . Awesome !!!! thank you
> all
>

Ah ah, happy to have made you day. Yes, Slang is the awesome thing for
integrating things. You can debug in Pharo, and then compile to C. How cool
is that?

>
> Ok how about this visitor thing ? any links to it , no idea what that is
> and how to use it in pharo. Is it a way to code like continuations ?
>

Check the FileSystem-Core-Implementation package.

Look at the FileSystemGuide and how ti works, including the
FileSystemVisitor and its Collect and Select visitors down there.

It is interesting material to get to terms with the Visitor/Guide thing.

I reused/cloned a ton of this code for my current project where I do have
to navigate network equipement structures and generate probes along the way.

A tad mind twisting at the beginning but very useful once you get it.

Once you have the guide, you can visit all the way you want. Like here, I
generate HTML tree controls, D3 graphics, SNMP probes etc.

There are samples also for AST, but this is a tad too much for me at the
moment.



> About LLVM sound very cool and I was googling about that few hours ago but
> from what I have read is a very undocumented part of LLVM so that maybe
> easier said than done. Looks like Pharo is not the only project having
> issues with documentation ;)
>
> So it looks like I will be sticking with Pharo after all :D
>

Ah, swallowing the red pill is nearing.

Enjoy,
Phil

>
>
> On Mon, Sep 15, 2014 at 2:28 PM, Serge Stinckwich <
> serge.stinckwich at gmail.com> wrote:
>
>> On Mon, Sep 15, 2014 at 12:31 PM, phil at highoctane.be <phil at highoctane.be>
>> wrote:
>> > On Mon, Sep 15, 2014 at 11:33 AM, Serge Stinckwich
>> > <serge.stinckwich at gmail.com> wrote:
>> >>
>> >> On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo
>> >> <santiagobragagnolo at gmail.com> wrote:
>> >> >  I may be wrong, but I think the closest thing out there is Slang. Is
>> >> > the
>> >> > pseudo smalltalk used to develop the VM.
>> >> >
>> >> > Also there is a project for generating C for arduino, (a project
>> related
>> >> > with EToys), but i am not sure about how complete is.
>> >>
>> >> Both are subset of Smalltalk. This is best path to follow I guess:
>> >> define your own DSL for your needs and implement a visitor to do code
>> >> generation.
>> >> We have done that for epidemiological modeling.
>> >
>> >
>> > Or combine both: visitor which uses CCodeGenerator for emitting the
>> result.
>>
>> Yes, interesting idea, instead of generating strings!
>>
>> --
>> Serge Stinckwich
>> UCBN & UMI UMMISCO 209 (IRD/UPMC)
>> Every DSL ends up being Smalltalk
>> http://www.doesnotunderstand.org/
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20140915/10e97b68/attachment-0002.html>


More information about the Pharo-dev mailing list