Kjell Godo | 23 Mar 14:54
Picon

( picoVerse-:( language ideas ) )

Hi Ian
 
I would like to propose a few language ideas that I
am putting into picoLARC.  I am making a detailed
specification of picoLARC in Smalltalk.
 
picoLARC is to include all other languages within
itself as lisp dialects.
 
Macros use the same Object message dispatch
that Methods do.  A Macro is just a Method that
takes in KEGParseObjects and returns a
KEGParseObject which is then compiled.
 
A Programmer is an instance of a ProgrammerClass
which can be put into a Class at compile time and
then messages can be sent to that Programmer
from inside the code being compiled.  So an
Object oriented form of Macros is the result.
 
Thus all languages in picoLARC gain access to
Object Oriented lisp style Macros.
 
Instead of using different syntax for each language
in picoLARC lisp is used for each.  The human
programmer translates C# into a lisp style and
then the picoLARC compiler compiles that like
the C# compiler would.  It's probably too hard for
me to do but that's the idea.  The programmer
has to swap things around a bit but the underlying
spirit of the lisp style should be like C#, for instance.
 
anObject->method( ... )->method2( ... )
becomes
( ->method2 ( ->method anObject ... ) ... )
 
variable = expression ;
becomes
( = variable expression )
 
Now this will cause people's heads to explode.  But we
are doing it because then Macros can be used for each
different sub language in picoLARC.
 
Method dispatch is done via picoLARC GenericFunctions
such that no Dictionary lookup is needed for unique Methods
in leaf Classes( which have no subClasses ).  And for Object
level Methods an Array lookup is done instead of a Dictionary
lookup.
 
Nodules are sets of variables like namespaces but OOP.
 
( atIndex:put: aCollection i anObject )
 
The function name has one less : in it than there are inputs
so we know that this is a Message send.  aCollection is
the first input so it is the receiver.  The Class C of aCollection
is accessed and fed into the GenericFunction that is saved
in the atIndex:put: variable in the highest Nodule on the
Activation stack.  Then a lookup is done and a Function F is
returned that considers its first input to be the receiver of
the message.  The Function F is therefore a Method.
 
This form of Method dispatch can be used by the Macros
and the other language styles as well.  Prolog can be
Object Oriented in this way.
 
Each picoLARC expression can have a language prefix
that tells which Compilers are to compile it.
 
( lambdaLisp ... )
( prolog ... )
( c# ... )
( c++ ... )
( java ... )
 
So instead of using different syntax for each language
we use lisp dialects which unifies everything and makes it
so that we can include in picoLARC as many languages as
we want.  And yet all of them can make use of Macros.
Also the different languages can be mixed together easily
by the human programmer.
 
( lambdaLisp ...
       ( prolog ... )
       ( c# ... )
       ... )
 
lambdaLisp is the default.
 
Also Class Hierarchies are abstracted so that you can
have as many of them in each Nodule as you want.
A Hierarchy like the one in Smalltalk is proposed.
So you could have multiple Smalltalk like Hierarchies
if you want.
 
What do you think?  Could you use any of these ideas in
Cola?
 
Will there be a Cola for Windows?
 
Will the machine code generation also be reflective in
Cola?  That would be cool.
 
.net?
 
-Kjell
<div>
<div>Hi Ian</div>
<div>&nbsp;</div>
<div>I would like to propose a few language ideas that I</div>
<div>am putting into picoLARC.&nbsp; I am making a detailed</div>
<div>specification of picoLARC in Smalltalk.</div>
<div>&nbsp;</div>
<div>picoLARC is to include all other languages within</div>
<div>itself as lisp dialects.</div>
<div>&nbsp;</div>
<div>Macros use the same Object message dispatch</div>
<div>that Methods do.&nbsp; A Macro is just a Method that</div>
<div>takes in KEGParseObjects and returns a</div>
<div>KEGParseObject which is then compiled.</div>
<div>&nbsp;</div>
<div>A Programmer is an instance of a ProgrammerClass</div>
<div>which can be put into a Class at compile time and</div>
<div>then messages can be sent to that Programmer</div>
<div>from inside the code being compiled.&nbsp; So an</div>
<div>Object oriented form of Macros is the result.</div>
<div>&nbsp;</div>
<div>Thus all languages in picoLARC gain access to</div>
<div>Object Oriented lisp style Macros.</div>
<div>&nbsp;</div>
<div>Instead of using different syntax for each language</div>
<div>in picoLARC lisp is used for each.&nbsp; The human</div>
<div>programmer translates C#&nbsp;into a lisp style and</div>
<div>then the picoLARC compiler compiles that like</div>
<div>the C# compiler would.&nbsp; It's probably too hard for</div>
<div>me to do but that's the idea.&nbsp; The programmer</div>
<div>has to swap things around a bit but the underlying</div>
<div>spirit of the lisp style should be like C#, for instance.</div>
<div>&nbsp;</div>
<div>anObject-&gt;method( ... )-&gt;method2( ... )</div>
<div>becomes</div>
<div>( -&gt;method2 (&nbsp;-&gt;method anObject ...&nbsp;) ...&nbsp;)</div>
<div>&nbsp;</div>
<div>variable = expression ;</div>
<div>becomes</div>
<div>( = variable expression )</div>
<div>&nbsp;</div>
<div>Now this will cause people's heads to explode.&nbsp; But we</div>
<div>are doing it because then Macros&nbsp;can be used for each</div>
<div>different sub&nbsp;language in picoLARC.</div>
<div>&nbsp;</div>
<div>Method dispatch is done via picoLARC GenericFunctions</div>
<div>such that no Dictionary lookup is needed for unique&nbsp;Methods</div>
<div>in leaf Classes( which have no subClasses ).&nbsp; And for Object</div>
<div>level Methods an Array lookup is done instead of a Dictionary</div>
<div>lookup.</div>
<div>&nbsp;</div>
<div>Nodules are sets of variables like namespaces but OOP.</div>
<div>&nbsp;</div>
<div>( atIndex:put: aCollection i anObject )</div>
<div>&nbsp;</div>
<div>The function name has one less : in it than there are inputs</div>
<div>so we know that this is a Message send.&nbsp; aCollection is</div>
<div>the first input so it is the receiver.&nbsp; The Class C&nbsp;of aCollection</div>
<div>is&nbsp;accessed and fed into the GenericFunction that is saved</div>
<div>in the atIndex:put: variable in the highest Nodule on the </div>
<div>Activation stack.&nbsp; Then a lookup is done and a Function F&nbsp;is</div>
<div>returned that considers its first input to be the receiver of</div>
<div>the message.&nbsp; The Function F is therefore&nbsp;a Method.</div>
<div>&nbsp;</div>
<div>This form of Method dispatch can be used by the Macros</div>
<div>and the other language styles as well.&nbsp; Prolog can be</div>
<div>Object Oriented in this way.</div>
<div>&nbsp;</div>
<div>Each picoLARC expression can have a language prefix</div>
<div>that tells which Compilers are to compile it.</div>
<div>&nbsp;</div>
<div>( lambdaLisp ... )</div>
<div>( prolog ... )</div>
<div>( c# ... )</div>
<div>( c++ ... )</div>
<div>( java ... )</div>
<div>&nbsp;</div>
<div>So instead of using different syntax for each language</div>
<div>we use lisp dialects which unifies everything and makes it</div>
<div>so that we can include in picoLARC as many languages as</div>
<div>we want.&nbsp; And yet all of them can make use of Macros.</div>
<div>Also the different&nbsp;languages can be mixed together easily</div>
<div>by the human programmer.</div>
<div>&nbsp;</div>
<div>( lambdaLisp ...</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( prolog ... )</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ( c# ... )</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... )</div>
<div>&nbsp;</div>
<div>lambdaLisp is the default.</div>
<div>&nbsp;</div>
<div>Also Class Hierarchies are abstracted so that you can</div>
<div>have as many of them in each Nodule as you want.</div>
<div>A Hierarchy like the one in Smalltalk is proposed.</div>
<div>So you could have multiple Smalltalk like Hierarchies</div>
<div>if you want.</div>
<div>&nbsp;</div>
<div>What do you think?&nbsp; Could you use any of these ideas in</div>
<div>Cola?</div>
<div>&nbsp;</div>
<div>Will there be a Cola for Windows?</div>
<div>&nbsp;</div>
<div>Will the machine code generation also be reflective in</div>
<div>Cola?&nbsp; That would be cool.</div>
<div>&nbsp;</div>
<div>.net?</div>
<div>&nbsp;</div>
<div>-Kjell</div>
</div>
John Leuner | 26 Mar 21:54

Re: ( picoVerse-:( language ideas ) )

> Will the machine code generation also be reflective in
> Cola?  That would be cool.

Reflective in what way?

John

Kjell Godo | 28 Mar 06:08
Picon

Re: ( picoVerse-:( language ideas ) )

It seems to me that Cola contains a compiler C.
C takes the source code for Cola and compiles it to generate Cola.exe.
So within C there must be code to generate machine code.
You are making the next version of Squeak right?

Like Corman Lisp has got an assembler inside of it.

A completely opaque one.  Nothing in there is commented at all.

So this Cola Squeak would have an assembler inside of it
or something.  And you could see the code for the assembler
inside of the running Cola Squeak.  Just like you can see
the Squeak compiler within Squeak.  Which also seems to
be quite opaque.  I wish there was a book just about the
Squeak compiler.  Can you suggest any?

So I am guessing that the running Cola Squeak will have the
compiler and assembler within it.  And you will be able to
see them and modify them and then generate a new Cola.exe.

Instead of sticking byte codes into ByteArrays you would
be sticking machine code into lisp code vectors which I am
assuming are just ByteArrays.

Why doesn't Smalltalk do machine code vectors like Lisp does?

Would that make the debugger not work anymore?

I think the SmalltalkMT has debugger problems because it is
all compiled into machine code.

So reflective means that you can see the compiler and assembler
inside of the running Cola Squeak just like you can see the
byte code compiler inside of regular Squeak.

Is this in fact what is going on inside of Cola?
Will it be a machine coded version of Squeak ala Lisp?
Lisp can do both interpreted and compiled to machine code.
Will Cola be ported to Windows?  Which Linux does it run on?
How might one go about trying to understand how it works?
Why wasn't Cola coded up in Squeak?  I should think that
Squeak could generate machine code just as easily as C++.
Even better.

Kjell

On 3/26/08, John Leuner
<jewel@...> wrote:
> > Will the machine code generation also be reflective in
> > Cola?  That would be cool.
>
> Reflective in what way?
>
> John
>
>
>
> _______________________________________________
> fonc mailing list
> fonc@...
> http://vpri.org/mailman/listinfo/fonc
>

Igor Stasenko | 28 Mar 07:02
Picon

Re: ( picoVerse-:( language ideas ) )

On 28/03/2008, Kjell Godo <squeaklist@...> wrote:
> It seems to me that Cola contains a compiler C.
>  C takes the source code for Cola and compiles it to generate Cola.exe.
>  So within C there must be code to generate machine code.
>  You are making the next version of Squeak right?
>
>  Like Corman Lisp has got an assembler inside of it.
>
>  A completely opaque one.  Nothing in there is commented at all.
>
>  So this Cola Squeak would have an assembler inside of it
>  or something.  And you could see the code for the assembler
>  inside of the running Cola Squeak.  Just like you can see
>  the Squeak compiler within Squeak.  Which also seems to
>  be quite opaque.  I wish there was a book just about the
>  Squeak compiler.  Can you suggest any?
>
>  So I am guessing that the running Cola Squeak will have the
>  compiler and assembler within it.  And you will be able to
>  see them and modify them and then generate a new Cola.exe.
>
>  Instead of sticking byte codes into ByteArrays you would
>  be sticking machine code into lisp code vectors which I am
>  assuming are just ByteArrays.
>
>  Why doesn't Smalltalk do machine code vectors like Lisp does?
>
>  Would that make the debugger not work anymore?
>
>  I think the SmalltalkMT has debugger problems because it is
>  all compiled into machine code.
>
>  So reflective means that you can see the compiler and assembler
>  inside of the running Cola Squeak just like you can see the
>  byte code compiler inside of regular Squeak.
>
>  Is this in fact what is going on inside of Cola?
>  Will it be a machine coded version of Squeak ala Lisp?
>  Lisp can do both interpreted and compiled to machine code.
>  Will Cola be ported to Windows?  Which Linux does it run on?
>  How might one go about trying to understand how it works?
>  Why wasn't Cola coded up in Squeak?  I should think that
>  Squeak could generate machine code just as easily as C++.
>  Even better.
>

Good point. A native code compiler can be implemented in any language.
Since COLA is a compiler itself, it can omit using C compilers or any
routines provided by C compiler for generating machine code.
Btw, there is a native compiler in squeak - Exupery which can generate
native code.

Yes, debugging the machine code adds complexity to compiler/debugger,
but this can be done one way or another.
The only bad side of native code, comparing to byte code, that it's
not portable. So, in case if image compiled methods contain native
code, you need to recompile them when starting image in different
platform, which means that you need a bootstrapping compiler already
present for given platform.

--

-- 
Best regards,
Igor Stasenko AKA sig.

Hans-Martin Mosner | 28 Mar 10:22
Picon
Favicon

Re: ( picoVerse-:( language ideas ) )

Igor Stasenko schrieb:
> On 28/03/2008, Kjell Godo <squeaklist@...> wrote:
>   
>> It seems to me that Cola contains a compiler C.
>>  C takes the source code for Cola and compiles it to generate Cola.exe.
>>  So within C there must be code to generate machine code.
>>  You are making the next version of Squeak right?
>>     
Well, "next version of Squeak" is probably not the right expression.
COLA is an approach to implementing the target system (whatever that may
be) consistently down to the lowest layers (machine code / hardware). If
I understand the code correctly, the current incarnation of compilers
use the platform's C compiler for static code generation, but include
dynamic code generation as well.
> Good point. A native code compiler can be implemented in any language.
> Since COLA is a compiler itself, it can omit using C compilers or any
> routines provided by C compiler for generating machine code.
> Btw, there is a native compiler in squeak - Exupery which can generate
> native code.
>
> Yes, debugging the machine code adds complexity to compiler/debugger,
> but this can be done one way or another.
> The only bad side of native code, comparing to byte code, that it's
> not portable. So, in case if image compiled methods contain native
> code, you need to recompile them when starting image in different
> platform, which means that you need a bootstrapping compiler already
> present for given platform.
>
>   
It should be reasonably possible to implement a bytecode interpreter /
JIT compiler within the COLA framework. Then you'd have the advantages
of both worlds. Of course, the complete architecture would have to be
designed in such a way that platform-independent objects with associated
bytecode methods can be handled separately from the platform-dependent code.
But unlike the current Squeak VM, where the platform- and CPU-dependent
part is statically compiled and immutable, with COLA the
platform-dependent part is just as malleable as the platform-independent
part.

Cheers,
Hans-Martin


Gmane