Computer Science Canada

Languages written in their own langauge

Author:  btiffin [ Wed Apr 30, 2008 2:19 pm ]
Post subject:  Languages written in their own langauge

Hello again

My questions may start to get a little more technical. This one is regarding the source code used to write a language.

Do you care if a language can write itself? Forth is written in Forth. C is written in C with a little bit of native chip assembler. Not too many other languages have this as native feature. Note; any Turing Complete language can be used to write itself, but I'm discussing a feature of the language more native than creating machine code in a scripting language and pretending that that is a self boot image. Ignore the whole machine code or assembler to boot strap an initial executable that can then be tossed away issue.

If you do care, (or think it's neat if not all that useful in day to day coding), would you target PE-COFF or ELF if you were writing a language from scratch?

Me; I'm a little leary of PE-COFF and the whole proprietary nature of MS, but the target audience is orders of magnitudes larger. Are you bothered by such issues? Should a language destined for self bootable image writing start out closely linked to an OS or link formats used? Would a language that had a feature of creating self bootable images be a reason for you to check it out?

Within all those questions, the main one of interest to me today is PE-COFF or ELF. But I'd also like your feedback on the more cerebral questions as well.

Thanks once again.

Author:  wtd [ Wed Apr 30, 2008 3:25 pm ]
Post subject:  RE:Languages written in their own langauge

Just a few: Lisp, Forth, Pascal, Delphi, C, Modula-2, Oberon, Smalltalk, OCaml, and FreeBASIC.

Author:  btiffin [ Wed Apr 30, 2008 5:37 pm ]
Post subject:  Re: RE:Languages written in their own langauge

wtd @ Wed Apr 30, 2008 3:25 pm wrote:
Just a few: Lisp, Forth, Pascal, Delphi, C, Modula-2, Oberon, Smalltalk, OCaml, and FreeBASIC.


Ok you got me. Smile But I hope you see where I'm going with this question. As before, any Turing Complete language is capable, but I'm curious about whether up and coming coders care about such issues. Most of the languages I use on a regular basis except GForth, ship with (or are built from) C sources. Niklaus Wirth really is a shiny example of a designer that built this type of capability into most of his creations. And yes you are correct, it may not be as rare as I hinted at. Though I've never seen a Pascal written in Pascal; now you've made me curious to go look. Smile

Cheers

Author:  wtd [ Thu May 01, 2008 12:00 am ]
Post subject:  RE:Languages written in their own langauge

Language designers who really like their language tend to prefer to use it to build their language.

Author:  btiffin [ Thu May 01, 2008 12:40 am ]
Post subject:  Re: RE:Languages written in their own langauge

wtd @ Thu May 01, 2008 12:00 am wrote:
Language designers who really like their language tend to prefer to use it to build their language.
Umm, not that I like to temp fate and argue with a compsci god, Smile but I'll disagree. My heroes Carl, Guido, Larry, Matz, Bertrand, Ralph, ..., all love their designs, but still use C to pump out binaries. John and Chuck are notable exceptions along with Niklaus. Does James have a Java that drives Java yet? I know he wants to, but got stuck in a sandbox last I heard (a long time ago, I'll admit). No idea what drives the Digitalmars D compiler, but I'd bet Walter wants it in D sooner than later.

To be honest, one of the things I learnt about computer science a long time ago; I haven't got a clue when it comes to the depth and breadth of the field.

Keep up the good works wtd; I like to be kept on my toes and honest when I post here. Especially when impressionable youth are at risk of potentially believing the ramblings of an old guy. Smile

Main question still stands PE-COFF or ELF?

Cheers

Author:  Clayton [ Thu May 01, 2008 7:38 am ]
Post subject:  RE:Languages written in their own langauge

I think you'll find wtd to not be "today's youth", though it's hard to say not knowing how old you are Wink

Author:  btiffin [ Thu May 01, 2008 9:53 am ]
Post subject:  Re: RE:Languages written in their own langauge

Clayton @ Thu May 01, 2008 7:38 am wrote:
I think you'll find wtd to not be "today's youth", though it's hard to say not knowing how old you are Wink
Sorry, I'm not worried about corrupting or misleading wtd, I can tell he has an excellent grasp of the compsci reality. And that, not overly common, human ability to see through fud and incorrect or mis information. Smile

Just so everyone knows. I'm 44 going on 80. Spent most of my young days working in Forth on Digital Vax hardware running OpenVMS, and ignored most of the personal computer and web trends through the 80, 90s. Then I dropped out of coding from 2001 till just last year, so I completely ignored the trends of the first half of the 00s. I sold work boots/army surplus and pounded nails for those years. I'm still playing catch up. Much to learn and compsci.ca has been a great place for me and my curiosity. And I'll apologize, I may be posting misinformation as I catch up - but I'll add, never on purpose, just by ignorance. And I don't mind being corrected. I would prefer that over someone taking what I spew as valid when it is not.

Oh yeah, and I overuse smilies ... just so everyone knows I'm more clown than judge or jury. Compsci is a serious business, but it is also way fun.

Still stands. Opinions on PE-COFF or ELF? Smile

Cheers.

Author:  wtd [ Thu May 01, 2008 11:39 am ]
Post subject:  RE:Languages written in their own langauge

Binary formats are, for 99.99999% of the computing world these days irrelevant. In other words... I have no opinion either way as long as it all works correctly.

You are older than I, and by more than I am older than most of the others here.

Author:  btiffin [ Thu May 01, 2008 2:50 pm ]
Post subject:  Re: RE:Languages written in their own langauge

wtd @ Thu May 01, 2008 11:39 am wrote:
Binary formats are, for 99.99999% of the computing world these days irrelevant. In other words... I have no opinion either way as long as it all works correctly.


Thanks muchly; that's just the kind of statement of opinion I was hoping for.

wtd @ Thu May 01, 2008 11:39 am wrote:
You are older than I, and by more than I am older than most of the others here.


Yep. Old Guy. Smile Here more to play catch up on on the nice things I missed out on over the last 6 years. Well that, and to satisfy my curiosities about the up and comers and general computer science trends. Hope people here don't mind too too much.

Cheers

Author:  shaon [ Sat May 24, 2008 11:12 am ]
Post subject:  Re: Languages written in their own langauge

What about java? what is java written in?

Author:  btiffin [ Sat May 24, 2008 11:58 am ]
Post subject:  RE:Languages written in their own langauge

Last I looked, the JVM's are ANSI C and the frontend compilers are Java. Sun's implementation anyway. gcj, being part of gcc is mostly C and CC source files but I don't keep up with these things. Things have stabilized so much over the last 5 years that binary packages are just easier to deal with than the source tar balls. Smile

There is something about GNU Java moving to an Eclipse frontend. So it's all just bloat to me.

C is a good language to know. imho, it is the grandaddy of pretty much everything cool in computing now-a-days. Even my favourite, REBOL, is written in C. But (and the reason for the thread in the first place) my second favourite, polyForth, is written in polyForth.

Cheers

Author:  michaelp [ Sat May 24, 2008 1:47 pm ]
Post subject:  RE:Languages written in their own langauge

I'm just wondering: How can you write a language in its own language?

Author:  Tony [ Sat May 24, 2008 1:57 pm ]
Post subject:  RE:Languages written in their own langauge

Same way you write a language in any other language.

Assuming there exists a language Foo with a compiler for it written in C.

You write the code in Foo, for the compiler for Foo. You create your new compiler same as you would have any other Foo program. Then use this new compiler to compile itself. And BAM! You no longer need the compiler written in C.

Author:  Aziz [ Sat May 24, 2008 11:33 pm ]
Post subject:  RE:Languages written in their own langauge

And then there's the libraries, which is a big part of a language itself. Java's library is mostly written in Java, and you can the source for all packages if you unzip the 'src' file in the install directory. There are some complex and super basic methods that are native, though. At lot of Object's methods are native (through JNI, which is still part of the language I guess Razz)

Author:  Dan [ Sun May 25, 2008 7:52 am ]
Post subject:  Re: RE:Languages written in their own langauge

michaelp @ 24th May 2008, 1:47 pm wrote:
I'm just wondering: How can you write a language in its own language?


Bootstrapping

Author:  Hendo [ Wed Mar 25, 2009 12:08 pm ]
Post subject:  RE:Languages written in their own langauge

Macs cocoa language (also known as Objective-C) was written in Objective-C. However it is just a branch of C so thats only half true (im sure c was used as well.) I belive REALbasic was programmed in REALbasic as well.

Author:  wtd [ Wed Mar 25, 2009 12:17 pm ]
Post subject:  RE:Languages written in their own langauge

Cocoa and the Objective-C language are two entities. Cocoa i a framework which uses Obj-C, but Obj-C can be used more generally.

Author:  wtd [ Wed Mar 25, 2009 12:32 pm ]
Post subject:  RE:Languages written in their own langauge

Btiffin: see Rakudo Perl6. They are using Perl6's new rules and grammers (which replace regular expressions) to create the parser for the language.

Initial experiments in implementing Perl6 have involved Perl5 and Haskell (Pugs). And, of course, Parrot is itself implemented largely in C.

Author:  saltpro15 [ Wed Mar 25, 2009 2:26 pm ]
Post subject:  RE:Languages written in their own langauge

How cool would it be if we had a video game that could write itself in real time as the player goes through it, so it never ends Very Happy just a dreamer's thought lol

Author:  Tony [ Wed Mar 25, 2009 2:36 pm ]
Post subject:  Re: RE:Languages written in their own langauge

saltpro15 @ Wed Mar 25, 2009 2:26 pm wrote:
just a dreamer's thought lol

We've had that for quite a while.... http://en.wikipedia.org/wiki/Procedural_generation

I'm not sure how you got to that, from bootstrapping though.

Author:  Prabhakar Ragde [ Wed Mar 25, 2009 3:18 pm ]
Post subject:  RE:Languages written in their own langauge

Most Scheme compilers and interpreters are written in Scheme, with some bits (either a kernel or some optimized functions) written in C or C++.

Author:  saltpro15 [ Wed Mar 25, 2009 3:30 pm ]
Post subject:  RE:Languages written in their own langauge

Tony, wtf is bootstrapping ? :S I just generally have good ideas, only to find out it's already been thought of Sad

Author:  Prabhakar Ragde [ Wed Mar 25, 2009 6:45 pm ]
Post subject:  RE:Languages written in their own langauge

By coincidence, I came across this today:

[url]http://en.wikipedia.org/wiki/Bootstrapping_(statistics)[/url]

I don't think it's what Tony had in mind, though.

(Edit: trying to get URL to work, which I have failed at.)

Author:  Tony [ Wed Mar 25, 2009 6:51 pm ]
Post subject:  Re: RE:Languages written in their own langauge

No, I've had a different kind of bootstrapping in mind. It might have been the one already mentioned earlier in the thread.
Dan @ Sun May 25, 2008 7:52 am wrote:
michaelp @ 24th May 2008, 1:47 pm wrote:
I'm just wondering: How can you write a language in its own language?


Bootstrapping

Author:  btiffin [ Wed Mar 25, 2009 6:54 pm ]
Post subject:  Re: RE:Languages written in their own langauge

wtd @ Wed Mar 25, 2009 12:32 pm wrote:
Btiffin: see Rakudo Perl6. They are using Perl6's new rules and grammers (which replace regular expressions) to create the parser for the language.

Initial experiments in implementing Perl6 have involved Perl5 and Haskell (Pugs). And, of course, Parrot is itself implemented largely in C.


wtd; cool. Will do on the checking out of Rakudo.

Yet ... none of these will ever match the bootstrapping capabilities of a well designed forth. I think Chuck Moore is written in Chuck Moore. Wink

Cheers


: