Parsing Pharo syntax to C/C++

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

Parsing Pharo syntax to C/C++

kilon.alios

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?

Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Santiago Bragagnolo
 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. 



2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?


Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

SergeStinckwich
On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo
<[hidden email]> 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.

Regards,

--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/

Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Thierry Goubier
In reply to this post by kilon.alios
Hi Kilon,

you don't need any parser to do that, you need something to generate C / C++ code :)

There are Smalltalk to C translators floating around, and I believe one of them is in the Squeak / Pharo code base to generate the VM (or part of it).

If you want to do it yourself, you probably should: explore the Ring model as a way to export the package / class structure in C++ (just generate text as you go) and also make a pass method by method, asking for the RBAST of the method, and a visitor to  generate the C / C++ equivalent to each node of the AST (and you'll find the Smalltalk AST very simple and nice :) ).

Thierry


2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?


Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

philippeback
In reply to this post by Santiago Bragagnolo
Slang has been externalized by Pavel. So, Smalltalk to C works.

Works nicely, even if there were a few glitches (like code generated twice at one point).
Nothing unfixable, I got the beast working.

Allows for things like: write Slang, generate C, compile into DLL, load DLL, run C code. All in a single shot.

PavelKrivanek/CCodeGenerator on SmalltalkHub (which looks like super slow/zombified).

Phil




 


On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo <[hidden email]> 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. 



2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?



Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

philippeback
In reply to this post by SergeStinckwich
On Mon, Sep 15, 2014 at 11:33 AM, Serge Stinckwich <[hidden email]> wrote:
On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo
<[hidden email]> 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.

Phil
 

Regards,

--
Serge Stinckwich
UCBN & UMI UMMISCO 209 (IRD/UPMC)
Every DSL ends up being Smalltalk
http://www.doesnotunderstand.org/


Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

SergeStinckwich
On Mon, Sep 15, 2014 at 12:31 PM, [hidden email] <[hidden email]> wrote:

> On Mon, Sep 15, 2014 at 11:33 AM, Serge Stinckwich
> <[hidden email]> wrote:
>>
>> On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo
>> <[hidden email]> 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/

Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Thierry Goubier
In reply to this post by philippeback
Hi Phil,

thanks for the update on Slang to C. Allways significant to have that.

Two open questions:

- would a slang to x86 asm via NativeBoost be doable / a nice target?

- would targetting LLVM-IR be of interest?

Thierry

2014-09-15 12:29 GMT+02:00 [hidden email] <[hidden email]>:
Slang has been externalized by Pavel. So, Smalltalk to C works.

Works nicely, even if there were a few glitches (like code generated twice at one point).
Nothing unfixable, I got the beast working.

Allows for things like: write Slang, generate C, compile into DLL, load DLL, run C code. All in a single shot.

PavelKrivanek/CCodeGenerator on SmalltalkHub (which looks like super slow/zombified).

Phil




 


On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo <[hidden email]> 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. 



2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?




Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

kilon.alios
In reply to this post by SergeStinckwich
WOW this CCodeGenerator is great , I have downloaded it and tried the example and it generated the 'generated.c" file . Awesome !!!! thank you all 

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 ? 

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


On Mon, Sep 15, 2014 at 2:28 PM, Serge Stinckwich <[hidden email]> wrote:
On Mon, Sep 15, 2014 at 12:31 PM, [hidden email] <[hidden email]> wrote:
> On Mon, Sep 15, 2014 at 11:33 AM, Serge Stinckwich
> <[hidden email]> wrote:
>>
>> On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo
>> <[hidden email]> 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/


Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

philippeback
In reply to this post by Thierry Goubier
On Mon, Sep 15, 2014 at 1:28 PM, Thierry Goubier <[hidden email]> wrote:
Hi Phil,

thanks for the update on Slang to C. Allways significant to have that.

Two open questions:

- would a slang to x86 asm via NativeBoost be doable / a nice target?

I have to admit that I am happy to have Slang to C and it gets out of my competence from there :-)

Now, Slang to asm, that's quite a chasm to cross. If what asm does is doing syscalls, well, I don't see the added value right away as NB Assembler would do that already no?

Now, I am on Linux for about all of my Pharo code, so, C is nice enough.
 

- would targetting LLVM-IR be of interest?

Oh, that would be interesting. In order to get the IR interpreter and running things all over. Now, this should be extended to the whole VM then. But not sure we want that before we get 64 bits...

Ah, I should have taken the research career :-)

Phil
 

Thierry

2014-09-15 12:29 GMT+02:00 [hidden email] <[hidden email]>:
Slang has been externalized by Pavel. So, Smalltalk to C works.

Works nicely, even if there were a few glitches (like code generated twice at one point).
Nothing unfixable, I got the beast working.

Allows for things like: write Slang, generate C, compile into DLL, load DLL, run C code. All in a single shot.

PavelKrivanek/CCodeGenerator on SmalltalkHub (which looks like super slow/zombified).

Phil




 


On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo <[hidden email]> 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. 



2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?





Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

philippeback
In reply to this post by kilon.alios
On Mon, Sep 15, 2014 at 1:39 PM, kilon alios <[hidden email]> 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 <[hidden email]> wrote:
On Mon, Sep 15, 2014 at 12:31 PM, [hidden email] <[hidden email]> wrote:
> On Mon, Sep 15, 2014 at 11:33 AM, Serge Stinckwich
> <[hidden email]> wrote:
>>
>> On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo
>> <[hidden email]> 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/



Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Tudor Girba-2
Please pay careful attention: this is one of those Pharo libraries that might not meet industry standard. But, it is so small and elegant that even an amateur can have a say with it :).

The interesting thing about the red pill is that the reality that comes after taking the pill is less clean than the one from before the pill, But, it is richer!

You can still choose the world you want to live in :)

Doru


On Mon, Sep 15, 2014 at 2:02 PM, [hidden email] <[hidden email]> wrote:
On Mon, Sep 15, 2014 at 1:39 PM, kilon alios <[hidden email]> 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 <[hidden email]> wrote:
On Mon, Sep 15, 2014 at 12:31 PM, [hidden email] <[hidden email]> wrote:
> On Mon, Sep 15, 2014 at 11:33 AM, Serge Stinckwich
> <[hidden email]> wrote:
>>
>> On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo
>> <[hidden email]> 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/






--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

kilon.alios
In reply to this post by philippeback
thanks I am looking at it 

is this relevant to pharo ? --> http://en.wikipedia.org/wiki/Visitor_pattern

Sure if I can stay in pharo while coding in C/C++ then why not ? Even if I still have to do work outside pharo. The problem is beginners like me do not realize the potential of their tools because of lack of experience, so its more likely I give up than you who you are a much more experienced pharoer than me. 

Afterall Neo needed Morpheas to show him that he is the chosen one ;)

I invested a year of my life in pharo and I would love to invest a lot more and benefit back the community. This way everyone is a winner.  

Also Thierry mentioned Ring which led me to this http://rmod.lille.inria.fr/archives/papers/Uqui11a-RingJournalPaper-CSSJournal.pdf from the looks of it is a source code analyzer ? 

much to study , a lot of potential and another happy Pharo user :) 

On Mon, Sep 15, 2014 at 3:02 PM, [hidden email] <[hidden email]> wrote:
On Mon, Sep 15, 2014 at 1:39 PM, kilon alios <[hidden email]> 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 <[hidden email]> wrote:
On Mon, Sep 15, 2014 at 12:31 PM, [hidden email] <[hidden email]> wrote:
> On Mon, Sep 15, 2014 at 11:33 AM, Serge Stinckwich
> <[hidden email]> wrote:
>>
>> On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo
>> <[hidden email]> 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/




Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Thierry Goubier
In reply to this post by kilon.alios


2014-09-15 13:39 GMT+02:00 kilon alios <[hidden email]>:

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

LLVM is an industrial-class open source project included in, I believe, all GPU drivers (for compilation of CUDA and OpenCL code).

It is also one of the best documented low-level compilation toolkits with performance to match the other open source compiler (gcc). LLVM-IR is fairly well documented.
 

So it looks like I will be sticking with Pharo after all :D

:)

Thierry

Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Juan-2
In reply to this post by Santiago Bragagnolo
Hola Santiago


Como se llama tal proyecto, me podria ser util podria colaborar 

saludos 

Juan Marcelo


On Mon, Sep 15, 2014 at 6:28 AM, Santiago Bragagnolo <[hidden email]> 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. 



2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?



Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Santiago Bragagnolo
Que proyecto??  ?_? 

el que pasa smalltalk a c? estan hablando de slang



2014-09-15 14:29 GMT+02:00 Juan <[hidden email]>:
Hola Santiago


Como se llama tal proyecto, me podria ser util podria colaborar 

saludos 

Juan Marcelo


On Mon, Sep 15, 2014 at 6:28 AM, Santiago Bragagnolo <[hidden email]> 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. 



2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?




Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Thierry Goubier
In reply to this post by philippeback


2014-09-15 13:56 GMT+02:00 [hidden email] <[hidden email]>:
On Mon, Sep 15, 2014 at 1:28 PM, Thierry Goubier <[hidden email]> wrote:
Hi Phil,

thanks for the update on Slang to C. Allways significant to have that.

Two open questions:

- would a slang to x86 asm via NativeBoost be doable / a nice target?

I have to admit that I am happy to have Slang to C and it gets out of my competence from there :-)

Yes, I believe it is very cool as it is. You need a full C toolchain around to make it work.
 

Now, Slang to asm, that's quite a chasm to cross. If what asm does is doing syscalls, well, I don't see the added value right away as NB Assembler would do that already no?

Hum, I would more like SSE and AVX code done this way: matrix multiplications, bitmap processing, heavily used code, SciSmalltalk stuff on very large datasets.

To see NB only used as a way to write syscalls :(:(:(
 

Now, I am on Linux for about all of my Pharo code, so, C is nice enough.
 

- would targetting LLVM-IR be of interest?

Oh, that would be interesting. In order to get the IR interpreter and running things all over. Now, this should be extended to the whole VM then. But not sure we want that before we get 64 bits...

OpenCL, SPIR code generation and link to Cog.

The ability to generate better code than when targetting C.
 

Ah, I should have taken the research career :-)

Hum, you know that researchers are allways on the lookout for SMEs to collaborate on projects :-)

Thierry

Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Clément Béra
In reply to this post by Thierry Goubier
Hello,

Note that slang is a subset of smalltalk. The Slang compiler does not allow to compile smalltalk to C. It allows to compile a smalltalk with restricted message sends and classes to C.

2014-09-15 13:28 GMT+02:00 Thierry Goubier <[hidden email]>:
Hi Phil,

thanks for the update on Slang to C. Allways significant to have that.

Two open questions:

- would a slang to x86 asm via NativeBoost be doable / a nice target?

Yes it would be interesting. However, by having a Slang to C compiler, we're platform-independent, we can compile the C code to x86, x86_64 and ARM quite easily (some part of the VM are already processor dependent, but not so much). Targeting direct machine code implies evolving the Slang compiler for each new assembly code we support. It sounds like a lot of engineering work compared to our resources and the gain.

- would targetting LLVM-IR be of interest?

If you compile the C code with Clang instead of gcc, which starts to be the case because of the lack of support for gcc in the latest Mac OS X, you are already using LLVM IR because Clang uses it. As the VM use the GNU C extensions to improve performance, I do not think that targeting directly the LLVM IR would greatly improve performance. So it sounds like quite some engineering work for no gain.

However, I think Ronie was interested in doing such work. If he succeeds and reports performance improvement, then we can consider using his compiler to compile the VM.
 
Thierry

2014-09-15 12:29 GMT+02:00 [hidden email] <[hidden email]>:

Slang has been externalized by Pavel. So, Smalltalk to C works.

Works nicely, even if there were a few glitches (like code generated twice at one point).
Nothing unfixable, I got the beast working.

Allows for things like: write Slang, generate C, compile into DLL, load DLL, run C code. All in a single shot.

PavelKrivanek/CCodeGenerator on SmalltalkHub (which looks like super slow/zombified).

Phil




 


On Mon, Sep 15, 2014 at 11:28 AM, Santiago Bragagnolo <[hidden email]> 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. 



2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?





Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

kilon.alios
In reply to this post by Thierry Goubier
Yeah I think I mixed it up with something else, anyway I found a very nice tutorial how to make a working compiler with LLVM



looks like nativeboost on steroids !!!!


On Mon, Sep 15, 2014 at 3:26 PM, Thierry Goubier <[hidden email]> wrote:


2014-09-15 13:39 GMT+02:00 kilon alios <[hidden email]>:

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

LLVM is an industrial-class open source project included in, I believe, all GPU drivers (for compilation of CUDA and OpenCL code).

It is also one of the best documented low-level compilation toolkits with performance to match the other open source compiler (gcc). LLVM-IR is fairly well documented.
 

So it looks like I will be sticking with Pharo after all :D

:)

Thierry


Reply | Threaded
Open this post in threaded view
|

Re: Parsing Pharo syntax to C/C++

Juan-2
In reply to this post by Santiago Bragagnolo

Arduino to c++ /c

Best
Jmdc

El 15/09/2014 09:33, "Santiago Bragagnolo" <[hidden email]> escribió:
Que proyecto??  ?_? 

el que pasa smalltalk a c? estan hablando de slang



2014-09-15 14:29 GMT+02:00 Juan <[hidden email]>:
Hola Santiago


Como se llama tal proyecto, me podria ser util podria colaborar 

saludos 

Juan Marcelo


On Mon, Sep 15, 2014 at 6:28 AM, Santiago Bragagnolo <[hidden email]> 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. 



2014-09-15 11:04 GMT+02:00 kilon alios <[hidden email]>:

Is there a way to convert code from pharo to c or c++ ? Does pettit parser or other parsers offer such support ?




1234