Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Seed7 a new programming language

0 views
Skip to first unread message

thomas...@gmx.at

unread,
Jan 12, 2006, 7:34:11 AM1/12/06
to
Hello

I have written an interpreter, example programs and documentation for a
new programming language called Seed7.

In Seed7 new statements and operators can be declared easily.
Types are first class objects and therefore templates/generics need no
special syntax.

Seed7 is covered by the GPL (and LGPL for the Seed7 runtime library).

More information about Seed7 can be found at the Homepage:
http://seed7.sourceforge.net

There is also a wikipedia entry at:
http://en.wikipedia.org/wiki/Seed7

The Seed7 package can be downloaded from sourceforge:
http://sourceforge.net/projects/seed7

Greetings Thomas Mertes

Marcin 'Qrczak' Kowalczyk

unread,
Jan 12, 2006, 11:47:21 AM1/12/06
to
thomas...@gmx.at writes:

> I have written an interpreter, example programs and documentation
> for a new programming language called Seed7.

I can't find any facilities for creation of objects which are not
bound to variables, i.e. dynamic memory allocation. How would you
make a tree, e.g. abstract syntax tree? I tried to look at compiler
sources, but the parser (which creates a tree) is implemented in C.

Other examples seem to keep the whole program state directly in
variables, they don't seem to use any object references contained
in other objects.

--
__("< Marcin Kowalczyk
\__/ qrc...@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/

Gene

unread,
Jan 12, 2006, 1:46:48 PM1/12/06
to
This looks very interesting. A very nice effort.

I wonder if you have looked at the many extensible programming
languages that were tried in the 60s and 70s. Most recently an
ingeneous web programming system was built around a new language called
bigwig that had a very elegant type-based macro system to extend the
language.

All of these were discarded. The reason seems to be that most programs
are written once and read many times. If you allow the language to be
extended, then the reading process must begin with a study of what the
author did to extend the language rather than with the code itself. So
ultimately there is a net loss even though the extension mechanism and
the extensions themselves may be very, very elegant.

Hence you will see even overloading of operators, a very modest form of
"extension", outlawed in many production C++ shops. Bigwig was set
aside in favor of "jwig", a Java extension that loses the nice macros.

thomas...@gmx.at

unread,
Jan 12, 2006, 3:03:28 PM1/12/06
to
Hello

Thank you for beeing interested in Seed7. Hopefully I can help
you.

Object references contained in other objects can be found
in 'file's and 'text's. The types 'file' and 'text' are just
interfaces. The real classes behind these interfaces are
'external_file', 'screen_file', 'line_file', 'window_file',
etc. (they are all descendants of 'NULL_FILE').

Some of this types (classes) like 'line_file' (in line.s7i) or
'echo_file' (in echo.s7i) contain elements of type 'file'.

The current solution to allocate new objects like 'external_file',
'line_file', etc. works as follows:

When copying a 'line_file' to a 'file' the action "CLS_CPY2" is
used (declared with 'type_implements_interface(NULL_FILE, file) ).
This "CLS_CPY2" action switches the automatic memory management
for this 'line_file' object off. Therefore this 'line_file'
object stays in memory like an allocated object.

Since 'file's use an interface and class concept this makes
sense. It would also be possible to create trees this way.

To define a tree with primitive types (no interface) a structure
could be used (the devil is in the details):

There is the 'reference' type to hold a generic pointer. There
are the 'ptr' and 'varptr' abstract data types to hold typesafe
pointers. To allocate dynamic memory Seed7 contains the 'alloc'
and 'varalloc' functions defined for 'struct's.

But the use of type safe pointers is limited for now since it is
not possible to declare a struct type which contains an element
which can point to itself. Sorry but a type declaration like

const type: myType is new struct
var ptr myType: next is NIL;
end struct;

does not work now. I am working on a solution for this, but it
will take some time. In the meantime the 'reference' type and
type conversions can be used instead (but I know this is not
the perfect solution).

Another thing I want to point out:
Since 'array's, 'hash'es and 'set's can grow and shrink
dynamically there are lots of possibilitys to avoid pointers.
For example: Linked lists are not needed because of the
dynamic arrays.

I rewrote some example programs to use arrays and hashes
instead of the pointers they used before (an earlier version
of Seed7 supported pointers already). This rewrite made
several programs cleaner.

The tree generated by the analyzer (parser) is usable
with a reflection api. The reflection bases on the
'reference' and 'ref_list' types. This types are missing
a malloc (it was not needed to implement the compiler
comp.sd7 until now). If you want you are free to add
a reference malloc (I have no plan / concept for it).

You can see that Seed7 is work in progress and has room
to improve ( :-) ).

Greetings Thomas Mertes

Message has been deleted

thomas...@gmx.at

unread,
Jan 12, 2006, 4:16:54 PM1/12/06
to
Thanks for the praise.

Clearly a program is written once and read many times.
When every programmer extends a language with lots of
new statements reading becomes more difficult. But this
is not the point.

Declaring procedures and functions is also a form of
extending a language. And writing 'hard to read' programs
is also possible without the extension of a language.
Spaghetti code is possible in every programming language.
If somebody writes 'hard to read' programs it is the
problem of the programmer and not the problem of the
language.

I think it is necessary to destinguish between writing
programs and writing librarys. My example programs do
not contain declarations of new statements. The statements
are declared in librarys (mostly seed7_05.s7i).

It all boils down to discipline. Nobody is forced to use
a new feature like the declaration of statements. If
advanced features are used wisely (mostly in librarys)
and programs are written to be readable, I see no
principle problem (and no net loss).

Greetings Thomas Mertes

0 new messages