Related articles |
---|
[11 earlier articles] |
Re: Looking for volunteers for XL gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-11-29) |
Re: Looking for volunteers for XL jussi.santti@ard.fi (ardjussi) (2011-11-30) |
Re: Looking for volunteers for XL kaz@kylheku.com (Kaz Kylheku) (2011-12-01) |
Re: Looking for volunteers for XL kaz@kylheku.com (Kaz Kylheku) (2011-12-01) |
Re: Looking for volunteers for XL blog@rivadpm.com (Alex McDonald) (2011-12-01) |
Re: Looking for volunteers for XL jgk@panix.com (2011-12-13) |
Re: Looking for volunteers for XL thomas.mertes@gmx.at (tm) (2012-01-03) |
From: | tm <thomas.mertes@gmx.at> |
Newsgroups: | comp.compilers |
Date: | Tue, 3 Jan 2012 09:28:24 -0800 (PST) |
Organization: | Compilers Central |
References: | 11-11-048 11-11-053 11-11-054 11-11-058 11-11-060 |
Keywords: | design |
Posted-Date: | 06 Jan 2012 10:00:44 EST |
On Nov 27 2011, 11:24 pm, "BartC" <b...@freeuk.com> wrote:
> A self-extensible language sounds like a good idea and might well
> work. I admit I've never used one ...
Really?
AFAIK you tried Seed7 a little bit (Thank you four your
fannkuch-redux benchmark program). So you tied an extensible
language without noticing that it is extensible. :-)
> (although I did play with designing
> one once, then gave up),
The trick is: You need to restrict the possibilities somehow to
"reasonable" features. I know that this depends on the point of
view...
> and have no idea what is and isn't possible;
> could you create a language that has C syntax for example, then add in
> a few Cobol-like statements or APL expressions?
Funny, such things were the original idea, which lead to Seed7.
Later I found that some restrictions really make sense. BTW:
Seed7 could do this, when APL operators are restricted to ASCII. :-)
The braces of C would conflict with existing braces in the
predefined Seed7 language (Seed7 uses them to define set literals).
So some of the existing Seed7 definitions need to be omitted, which
I did for the following example. The example defines a
C if-statement:
$ include "seed7x_05.s7i";
# Define the syntax of a simple C if-statment:
$ syntax expr: .if.().{.().} is -> 25;
# Define the semantic of a simple C if-statement:
const proc: if (in boolean: cond) {
(in proc: statement)
} is func
begin
if cond then
statement;
end if;
end func;
const proc: main is func
begin
# Use the C if-statement:
if (TRUE) {
writeln("okay");
}
end func;
I left out COBOL and APL, but you should see the principle.
BTW: I don't think that such a brutal mix of language features
(C, COBOL, APL) makes sense.
> Or is the syntax it's
> capable of rather more limited?
Seed7 is not overengineered, and other extensible languages should
also avoid this pitfall.
Greetings Thomas Mertes
--
Seed7 Homepage: http://seed7.sourceforge.net
Seed7 - The extensible programming language: User defined statements
and operators, abstract data types, templates without special
syntax, OO with interfaces and multiple dispatch, statically typed,
interpreted or compiled, portable, runs under linux/unix/windows.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.