Beginnings of a new language 
Author Message
 Beginnings of a new language

Hi,
    I'm currently considering the design of a new language.
My goal is to develop a language which is

    a) simple                                    -- i.e. not C++
    b) not written in hieroglyphics     -- i.e. not C, more like Ada 95

I want to be able to update code, in a running program
(or at least in a compiled unit) without the source (like TOM).
I also want to be able to add and remove methods and data from
'objects' -- i hate that word so much -- by copying (like prototype
languages).

Does anyone have any suggestions on what they'd like in a language?
(I've got more ideas but you'd never reach the end of this post if I
included them).

All thoughts welcome,
Chris Campbell

p.s.  I'm planning on writing the compiler in Ada 95 as it's the
        best languages I've learned thus far (just a useless piece of
information).



Wed, 23 Jul 2003 09:23:40 GMT  
 Beginnings of a new language

Quote:

> Hi,
>     I'm currently considering the design of a new language.
> My goal is to develop a language which is

>     a) simple                                    -- i.e. not C++
>     b) not written in hieroglyphics     -- i.e. not C, more like Ada 95

> I want to be able to update code, in a running program
> (or at least in a compiled unit) without the source (like TOM).
> I also want to be able to add and remove methods and data from
> 'objects' -- i hate that word so much -- by copying (like prototype
> languages).

You might want to have a look at Ruby, which has much of what you're
looking for out of the gate.

  http://www.ruby-lang.org
  http://www.rubycentral.com

Regards

Dave



Wed, 23 Jul 2003 13:46:49 GMT  
 Beginnings of a new language

Quote:

>> Hi,
>>     I'm currently considering the design of a new language.

Dave responded:

Quote:
> You might want to have a look at Ruby, which has much of what you're
> looking for out of the gate.

Dave, you don't get the point. Somebody who wants to create a new
language does so because he *wants* to create a new language. The
last thing he likes to hear is that such a language already exists.
Don't snatch somebodies toy.

Wouter Boeke



Wed, 23 Jul 2003 21:03:00 GMT  
 Beginnings of a new language

Quote:
> Dave, you don't get the point. Somebody who wants to create a new
> language does so because he *wants* to create a new language. The
> last thing he likes to hear is that such a language already exists.
> Don't snatch somebodies toy.

Well, I always wanted to design my own language, but finally concluded
that Haskell did most of the things I wanted to do in the right way
(even better than I planned), so I switched to improving Haskell :-)

--

 \__/
  ^^                      SYGNATURA ZASTPCZA
QRCZAK



Wed, 23 Jul 2003 21:17:19 GMT  
 Beginnings of a new language
Hi,
    Thanks for the pointers to Ruby.  I'm not going to give up just because
Ruby exists, but i do plan to learn it.

I've had an interesting email from Don Taylor conscerning exceptions and
"design by contract".
I've included it here:

Quote:
>    I would like to see exceptions caught by the code and a handler
invoked.
>    Thus is a variable represents an array index between 1 and 10 and you
>    calculate an index value of 11 the exception will be invoked when that
>    value is calculated, not sometime later when the array i subscripted
>    (or perhaps far later when you find the program has crashed on you)
>    And I would like to see "design by contract" to be a part of the code,
>    declarations about what is acceptable are part of the code and are
>    checked by the same exception mechanism.
>    Recovery from exceptions isn't a primary concern.  Bringing the whole
>    system to a screeching halt with a very clear announcement about what
>    just failed is lots more helpful to begin with.  That means someone
>    is going to have to go look at what happened and figure out what went
>    wrong.

Suppose the indexing variable was bound in some way to the array bounds.
This would enable an exception to be generated, catching the error.

I've been thinking more about this idea in general.  Is it possible to get
the compiler
to catch the error before it occurs?  i.e. get the compiler (or system) to
test the code
automatically.

I think it could be done but not easily.

What do you think?

Chris Campbell

p.s. i downloaded lua, as was suggested, and i'll have a wee look later,
       thanks for the suggestion.



Thu, 24 Jul 2003 03:46:13 GMT  
 Beginnings of a new language


Quote:
> Hi,
>     I'm currently considering the design of a new language.
>     b) not written in hieroglyphics     -- i.e. not C, more like Ada

A language where all the tokens were hieroglyphics... now that would be
interesting.

Sent via Deja.com
http://www.deja.com/



Thu, 24 Jul 2003 18:12:51 GMT  
 Beginnings of a new language


[...about exceptions on array bounds being exceeded...]

Quote:
> I've been thinking more about this idea in general.  Is it possible
> to get the compiler to catch the error before it occurs?  i.e. get
> the compiler (or system) to test the code automatically.

> I think it could be done but not easily.

> What do you think?

In general, it's not possible, unfortunately.  Consider a large program
that calculates a number n and then, as the last line of the program,
uses n to access an array.  The only way you the compiler could prove
that the final array access is in bounds is by running the program(!).

One runtime approach is to store the array bounds with the array and
only allow array access by integer (ie no pointers like C).  So, in C,
you might have something like

struct arrayStruct {
  int length
  byte* array

Quote:
}

and then when the compiler meets code that defines an array of bytes of
length 100 it generates one of these with length set to 100 and array
set to some malloced memory.

Array access in the program might look like myArray[i] which the
compiler would translate into something that returns
arrayStruct->array[i] if i >= 0 and i < arrayStruct->length otherwise it
would throw an exception.

The tricky bit is getting exceptions implemented :-)  You might just
want to stop the program with an error ("exceptions" in many languages
are more than this - they allow other parts of the program to take
control when an error occurs).

Good luck,
Andrew

One word of advice: if you actually want to write a compiler or
interpreter, keep the language nice and simple and don't go for too many
new ideas.  On the other hand, it's also fun planning a more complicated
language, even if you will never get round to implementing it..,

Sent via Deja.com
http://www.deja.com/



Thu, 24 Jul 2003 18:32:38 GMT  
 Beginnings of a new language

Quote:
> Suppose the indexing variable was bound in some way to the array bounds.
> This would enable an exception to be generated, catching the error.

> I've been thinking more about this idea in general.  Is it possible
> to get the compiler to catch the error before it occurs?  i.e. get
> the compiler (or system) to test the code automatically.

No. But if the natural style of using lists does not generally use
indices, but either some iterators or (like in SML, OCaml, Haskell,
Clean, Prolog, Lisp, Scheme) by recursively splitting the list into
its head (first element) and tail (the list of rest of elements),
then bounds checking is rarely needed.

--

 \__/
  ^^                      SYGNATURA ZASTPCZA
QRCZAK



Thu, 24 Jul 2003 21:14:46 GMT  
 Beginnings of a new language
Indeed.


Fri, 25 Jul 2003 02:44:30 GMT  
 Beginnings of a new language
Could one not bind a variable to the array bounds,

e.g.

procedure doSomething is
    let x be an array (1..10);
    let y be in range x;
begin
    do something with y; -- the moment y exceeds range then exception
                                    -- is generated;
    do something with x;
end doSomething;

Something similar can be done in Ada 95 using subtypes.
You need a subtype for every array to do it in Ada though.
(I'll check this with the folks on comp.lang.ada).

Bye,
Chris Campbell


Quote:


> [...about exceptions on array bounds being exceeded...]
> > I've been thinking more about this idea in general.  Is it possible
> > to get the compiler to catch the error before it occurs?  i.e. get
> > the compiler (or system) to test the code automatically.

> > I think it could be done but not easily.

> > What do you think?

> In general, it's not possible, unfortunately.  Consider a large program
> that calculates a number n and then, as the last line of the program,
> uses n to access an array.  The only way you the compiler could prove
> that the final array access is in bounds is by running the program(!).

> One runtime approach is to store the array bounds with the array and
> only allow array access by integer (ie no pointers like C).  So, in C,
> you might have something like

> struct arrayStruct {
>   int length
>   byte* array
> }

> and then when the compiler meets code that defines an array of bytes of
> length 100 it generates one of these with length set to 100 and array
> set to some malloced memory.

> Array access in the program might look like myArray[i] which the
> compiler would translate into something that returns
> arrayStruct->array[i] if i >= 0 and i < arrayStruct->length otherwise it
> would throw an exception.

> The tricky bit is getting exceptions implemented :-)  You might just
> want to stop the program with an error ("exceptions" in many languages
> are more than this - they allow other parts of the program to take
> control when an error occurs).

> Good luck,
> Andrew

> One word of advice: if you actually want to write a compiler or
> interpreter, keep the language nice and simple and don't go for too many
> new ideas.  On the other hand, it's also fun planning a more complicated
> language, even if you will never get round to implementing it..,

> Sent via Deja.com
> http://www.deja.com/



Fri, 25 Jul 2003 02:55:00 GMT  
 Beginnings of a new language

Quote:
>A language where all the tokens were hieroglyphics...
>now that would be interesting.

Perl :)


Fri, 25 Jul 2003 03:02:30 GMT  
 Beginnings of a new language

Yep, I guess that would work (I think Pascal might have something
similar too) (I was only saying that you couldn't get the compiler to
prove that a program would never access an array out of bounds, not that
you couldn't cath it if it happened).

Andrew

Quote:

> Could one not bind a variable to the array bounds,

> e.g.

> procedure doSomething is
>     let x be an array (1..10);
>     let y be in range x;
> begin
>     do something with y; -- the moment y exceeds range then exception
>                                     -- is generated;
>     do something with x;
> end doSomething;

> Something similar can be done in Ada 95 using subtypes.
> You need a subtype for every array to do it in Ada though.
> (I'll check this with the folks on comp.lang.ada).



Fri, 25 Jul 2003 06:34:44 GMT  
 Beginnings of a new language
Sorry i thought you meant that it couldn't be caught if it happened,
not that it couldn't be proved so.

My mistake,
Chris Campbell



Fri, 25 Jul 2003 06:38:47 GMT  
 Beginnings of a new language

Quote:

> Hi,
>     I'm currently considering the design of a new language.
> My goal is to develop a language which is

>     a) simple                                    -- i.e. not C++
>     b) not written in hieroglyphics     -- i.e. not C, more like Ada 95

> I want to be able to update code, in a running program
> (or at least in a compiled unit) without the source (like TOM).
> I also want to be able to add and remove methods and data from
> 'objects' -- i hate that word so much -- by copying (like prototype
> languages).

Have a look on Common Lisp where you'll find such things. Maybe it
gives you some idea. A book about this "special" facilities from
Common Lisp is
"The Art of the Metaobject Protocol"

I do not want to encouage nor discourage you. Just some points from
what we have done.

We decided 2 years ago to develop a new language. Our Goal was clear
from the beginning, in fact we did implement large parts of the
langauge but anyway it's not ready yet. The Goal was to give a tool at
hand which is especially good for the maintencance stage. And we have
planned this tool to be an applicaton and extension
language. Simular to what Visual Basic seem to be for Windows. An
application and extension language.

We
started from Eiffel and tried to find out the weak points of that
language and how to improve on them. I do think we found a "good
solution", anyway that's not the point. The point is that we tried to
combine OO and FP, there are just a few languages out there which does
this.

But there are so much languages out there that you often find
something that suits your needs. Now during that development I looked
into a lot of other languages, e.g Haskell, Python, Ruby, Smalltalk,
OCAML, ...

And then I encountered Common Lisp and suddenly our idea seem not so
"great". A lot of things we like to have can be found there and a
bunch more. So in fact I'm quite sure it would have been better to
"improve" Lisp into that areas which we think are important. But
probably it would have been better to go with Common Lisp. Here are
some reasons

- any programming style is supported (FP, OP, IP ...)
- a powerful macro system to "write your own language"
- extremly scalable and flexible.
- matured development environments

The only problem with Common Lisp IMHO is that it's Flexibility is
somewhat overwhelming. You have to learn so many different things and
be quite good at all the different kinds of programming style that I
would say the learning curve is extremly steep. The basics are simple
but beyond ...

So mayber in short. I would suggest looking into different languages
and write down what you like about it and what not. You can look over
that notices later and see if you want to go the improvement way or
the "revolution" way. Just I learned during that two years that
building a general programming language is not a piece of cake. My
respect for developers of langauges like Haskell, Ocaml, Common Lisp
etc has risen by some orders of magnitude.

I hope this was not too bothering

Friedrich



Fri, 25 Jul 2003 17:01:28 GMT  
 Beginnings of a new language
What's a scripting language?

I've have Ruby and was wondering what's the difference
between scripting and non-scripting languages?

Thanks in advance,
Chris Campbell



Fri, 25 Jul 2003 17:38:14 GMT  
 
 [ 45 post ]  Go to page: [1] [2] [3] [4]

 Relevant Pages 

1. Ada as a beginning language

2. Use a new language: Structured Programming Language

3. Information about new technology with new programming language .

4. Found a new interpreted language

5. Found a new interpreted language

6. Found a new interpreted language

7. New Scientist Puzzle and Oddball Languages

8. new C# language features - Generics, Anonymous Methods - Partial Types

9. New language Avail for PC and Mac

10. Found a new interpreted language

11. Syntax Questions for a new language with somewhat Smalltalk-like syntax

12. Found a new interpreted language

 

 
Powered by phpBB® Forum Software