High language to express low level code

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

High language to express low level code

pierre misse
Hello,

I'm currently trying to create a "high" level language to that aims to express low level concepts through transpilation to C.

I have a limited experience building such programs, and thought people who build virtual machines would be the right group of people to ask what they need in low level programing! 
I've also made some research, and stumbled Slang, on which i found little documentation (probably because i didn't find the right combination of words).

So if you have a bit of time to share, i'd love to know:
  • What you kind of concepts you need
  • What's not required, but interesting  
  • What you'd wish to hide from C to be taken care of by the transpiler
Thank you in advance.

Regards, 
Pierre Misse.


Reply | Threaded
Open this post in threaded view
|

Re: High language to express low level code

David T. Lewis
On Tue, Apr 02, 2019 at 06:03:20AM +0000, pierre misse wrote:

> Hello,
>
> I'm currently trying to create a "high" level language to that aims to express low level concepts through transpilation to C.
>
> I have a limited experience building such programs, and thought people who build virtual machines would be the right group of people to ask what they need in low level programing!
> I've also made some research, and stumbled Slang, on which i found little documentation (probably because i didn't find the right combination of words).
>
> So if you have a bit of time to share, i'd love to know:
>
>   *   What you kind of concepts you need
>   *   What's not required, but interesting
>   *   What you'd wish to hide from C to be taken care of by the transpiler
>
> Thank you in advance.
>
> Regards,
> Pierre Misse.

Hi Pierre,

The term "Slang" refers to the subset of the Smalltalk language and
objects that can directly translated to C (or other language, such
as Javascript). It is not really a language in itself, rather it is
a part of the existing Smalltalk environment in Squeak. For various
reasons, the "slang" extensions are now maintained separately from
the core of Squeak, but conceptually (and in early Squeak releases),
the C translation capability should be considered an integral part
of Squeak, as described in this original paper:

 http://www.vpri.org/pdf/tr1997001_backto.pdf

The actual "slang" translator consists of a set of TMethod and
TParseNode classes that are used to map the parse tree for a
Smalltalk method into translated C code, along with a CCodeGenerator
class that coordinates the translation process.

The Smalltalk to C (or Javascript) capability is not intended to
be a general purpose languange. The general purpose language in
this case is of course Smalltalk itself, and the slang translator
serves as an optimizer to translate the virtual machine (which is
written primarily in Smalltalk) into C to produce a high performance
runtime.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: High language to express low level code

Eliot Miranda-2
In reply to this post by pierre misse
Hi Pierre,

On Mon, Apr 1, 2019 at 11:03 PM pierre misse <[hidden email]> wrote:
Hello,

I'm currently trying to create a "high" level language to that aims to express low level concepts through transpilation to C.

I have a limited experience building such programs, and thought people who build virtual machines would be the right group of people to ask what they need in low level programing! 
I've also made some research, and stumbled Slang, on which i found little documentation (probably because i didn't find the right combination of words).

So if you have a bit of time to share, i'd love to know:
  • What you kind of concepts you need

That depends pn the architecture you choose.  There are static and dynamic approaches, approaches centered around optimization and JIT com platoon and approaches centered around embedding a domain-specific language (DSL) in a high-level language to allow for specific low-level code to be generated.

I would love for you to direct your attention to Ronie Salgado's work on Lowcode, and Clément Béra's and my work on Sista and Scorch.  Ronie's work is a combination of providing a DSL for communicating with graphics renderers.  This fairs within the extensions to the bytecode set Clément and I have designed for aggressive adaptive optimization in the context of a JIT.  Note that Ronie's subset of bytecodes has also shown speedups in a pure interpreter.  We have papers on both systems.
 
  • What's not required, but interesting  
I don't have time or resources to explore the inessential ;-) 
  • What you'd wish to hide from C to be taken care of by the transpiler
For me C is an implementation language; a portable assembler.  There really isn't any need to hide anything from C.  But the only time I pay attention to C is when I have to debug the system in the C world, which is thankfully rare, or shen the transpolar has a bug which manifests as a failure for the C to compiler.  So it's not an issue of hiding or revealing things to C.  It's an issue of C not being a useful context in which to get work done.  It's effectively write-only.
 
HTH

Thank you in advance.

Regards, 
Pierre Misse.



--
_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

TR: High language to express low level code

pierre misse
Thank you guys for your answers !

@Dave Thank you for the precisions.
 I actually had read this article, and
 -Extending the Squeak Virtual Machine by Andrew C. GreenBerg
 -Two decade of Smalltalk VM Development by Eliot Miranda , Clement Bera, Elisa Gonzalez Boix, and Dan Ingallls.
 But i didn't find much more on how it works. I was looking at it mostly from the transpilation point of vue. I'll have to take a closer look at TMethod/TparseNode/CCodeGenerator !

"The Smalltalk to C (or Javascript) capability is not intended to be a general purpose languange. The general purpose language in this case is of course Smalltalk itself, and the slang translator serves as an optimizer to translate the virtual machine (which is written primarily in Smalltalk) into C to produce a high performance runtime."
Did you mean "which is written primarily in SLANG"? For now I'm taking it as "the slang translator translate Smalltalk code" which feels weird to me.

@Eliot
"That depends on the architecture you choose."
I completely agree, and should have been more precise.
I tend to think of a static approach so far. Taking my language, translating it to C, then letting C files be compiled in assembly by a random c compiler (probably GCC). I'd like to be able to express both stand alone program, and libraries.

I actually read up on Sista on Clement's blog.
I also read an article on LowCode.
But as you just read, those approaches aren't really what I aim for !

'I don't have time or resources to explore the inessential ;-)'

True that ! But I meant more something that poped into your head, without having the time to follow up :p

'For me C is an implementation language; a portable assembler.'
I get this point of vue. But I meant something like what you have to use, because it's important but is annoying. The usual example is memory management (at least in general) which is why we have so much garbage collectors ! In that feeling, Hiding memory management in the transpiler would result for example in garbage collection[...]. I was trying to ask what do you have to manage, but bothers you, to see if it's possible to hide it. For example, I think in Slang, you don't bother about memory management, but you do require types. I don't know if that's more understandable.

Thanks you.

Pierre Misse

De : Squeak-dev <[hidden email]> de la part de Eliot Miranda <[hidden email]>
Envoyé : mardi 2 avril 2019 18:09
À : The general-purpose Squeak developers list
Objet : Re: [squeak-dev] High language to express low level code
 
Hi Pierre,

On Mon, Apr 1, 2019 at 11:03 PM pierre misse <[hidden email]> wrote:
Hello,

I'm currently trying to create a "high" level language to that aims to express low level concepts through transpilation to C.

I have a limited experience building such programs, and thought people who build virtual machines would be the right group of people to ask what they need in low level programing! 
I've also made some research, and stumbled Slang, on which i found little documentation (probably because i didn't find the right combination of words).

So if you have a bit of time to share, i'd love to know:
  • What you kind of concepts you need

That depends pn the architecture you choose.  There are static and dynamic approaches, approaches centered around optimization and JIT com platoon and approaches centered around embedding a domain-specific language (DSL) in a high-level language to allow for specific low-level code to be generated.

I would love for you to direct your attention to Ronie Salgado's work on Lowcode, and Clément Béra's and my work on Sista and Scorch.  Ronie's work is a combination of providing a DSL for communicating with graphics renderers.  This fairs within the extensions to the bytecode set Clément and I have designed for aggressive adaptive optimization in the context of a JIT.  Note that Ronie's subset of bytecodes has also shown speedups in a pure interpreter.  We have papers on both systems.
 
  • What's not required, but interesting  
I don't have time or resources to explore the inessential ;-) 
  • What you'd wish to hide from C to be taken care of by the transpiler
For me C is an implementation language; a portable assembler.  There really isn't any need to hide anything from C.  But the only time I pay attention to C is when I have to debug the system in the C world, which is thankfully rare, or shen the transpolar has a bug which manifests as a failure for the C to compiler.  So it's not an issue of hiding or revealing things to C.  It's an issue of C not being a useful context in which to get work done.  It's effectively write-only.
 
HTH

Thank you in advance.

Regards, 
Pierre Misse.



--
_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

Re: TR: High language to express low level code

David T. Lewis
On Mon, Apr 08, 2019 at 04:16:47PM +0000, pierre misse wrote:

> Thank you guys for your answers !
>
> @Dave Thank you for the precisions.
>  I actually had read this article, and
>  -Extending the Squeak Virtual Machine by Andrew C. GreenBerg
>  -Two decade of Smalltalk VM Development by Eliot Miranda , Clement Bera, Elisa Gonzalez Boix, and Dan Ingallls.
>  But i didn't find much more on how it works. I was looking at it mostly from the transpilation point of vue. I'll have to take a closer look at TMethod/TparseNode/CCodeGenerator !
>
> "The Smalltalk to C (or Javascript) capability is not intended to be a general purpose languange. The general purpose language in this case is of course Smalltalk itself, and the slang translator serves as an optimizer to translate the virtual machine (which is written primarily in Smalltalk) into C to produce a high performance runtime."
> Did you mean "which is written primarily in SLANG"? For now I'm taking it as "the slang translator translate Smalltalk code" which feels weird to me.
>

No, I mean Smalltalk. It is Smalltalk being translated to C or JavaScript.
There really is no such language as Slang, it is just a "slang" reference
to the subset of your Smalltalk image that can be successfully translated.

Dave


Reply | Threaded
Open this post in threaded view
|

Re: TR: High language to express low level code

pierre misse
Alright, I understand what you mean. 
Thank you for the precision Dave !

De : Squeak-dev <[hidden email]> de la part de David T. Lewis <[hidden email]>
Envoyé : mardi 9 avril 2019 14:28
À : The general-purpose Squeak developers list
Objet : Re: [squeak-dev] TR: High language to express low level code
 
On Mon, Apr 08, 2019 at 04:16:47PM +0000, pierre misse wrote:
> Thank you guys for your answers !
>
> @Dave Thank you for the precisions.
>  I actually had read this article, and
>  -Extending the Squeak Virtual Machine by Andrew C. GreenBerg
>  -Two decade of Smalltalk VM Development by Eliot Miranda , Clement Bera, Elisa Gonzalez Boix, and Dan Ingallls.
>  But i didn't find much more on how it works. I was looking at it mostly from the transpilation point of vue. I'll have to take a closer look at TMethod/TparseNode/CCodeGenerator !
>
> "The Smalltalk to C (or Javascript) capability is not intended to be a general purpose languange. The general purpose language in this case is of course Smalltalk itself, and the slang translator serves as an optimizer to translate the virtual machine (which is written primarily in Smalltalk) into C to produce a high performance runtime."
> Did you mean "which is written primarily in SLANG"? For now I'm taking it as "the slang translator translate Smalltalk code" which feels weird to me.
>

No, I mean Smalltalk. It is Smalltalk being translated to C or JavaScript.
There really is no such language as Slang, it is just a "slang" reference
to the subset of your Smalltalk image that can be successfully translated.

Dave