Re: Looking for volunteers for XL

Alex McDonald <blog@rivadpm.com>
Thu, 1 Dec 2011 12:11:17 -0800 (PST)

          From comp.compilers

Related articles
[9 earlier articles]
Re: Looking for volunteers for XL gah@ugcs.caltech.edu (glen herrmannsfeldt) (2011-11-28)
Re: Looking for volunteers for XL christophe@taodyne.com (Christophe de Dinechin) (2011-11-28)
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)
| List of all articles for this month |
From: Alex McDonald <blog@rivadpm.com>
Newsgroups: comp.compilers
Date: Thu, 1 Dec 2011 12:11:17 -0800 (PST)
Organization: Compilers Central
References: 11-11-048 11-11-053 11-11-054 11-11-061 11-11-063
Keywords: types, syntax
Posted-Date: 02 Dec 2011 00:34:13 EST

On Nov 28, 6:50 am, Timothy Knox <t...@thelbane.com> wrote:
> Somewhere on Shadow Earth, at Mon, Nov 28, 2011 at 04:45:11AM +0000, Kaz
Kylheku wrote:
>
> > [Are you aware of anyone actually doing this? I agree that you might
> > expect extensible languages to be handy design testbeds, but somehow
> > other than in the Lisp community, it didn't work out that way. -John]
>
> Well, John, I think the Forth community provide another counter-example.
> Granted, I am not aware of any projects of hundreds or thousands of
> Forth devs, but some rather significant projects have been done in Forth
> by small teams. And lest folks think Forth as a philosophy is dead, you
> might want to seehttp://factorcode.org/where the language is evolving
> in some very interesting directions.
> --
> Timothy Knox <mailto:t...@thelbane.com>
>
> Never trust a language where its users won't tell you that it sucks.
> -- Peter Corlett, on We Hates Software (about Python)
> [Forth is swell, but you can't extend its syntax the way you can in
> languages with BNF-based parsers and rewrite rules. -John]


To John's observation; perhaps its lack of syntax makes it seem that
way, but Forth programmers are dab hands at extending Forth. Want new
control structures beyond the basics? Not a problem; here's a CASE
ENDCASE constructed from Forth primitives, since the programmer has
access to the compiler; (comments are in ( ) or preceded by \ );


: case ( -- 0 ) 0 ; immediate
: of ( C:
                ( x -- )
                1+ >r
                postpone over postpone =
                postpone if postpone drop
                r> ; immediate
: endof ( C: orig1
                >r postpone else r> ; immediate
: otherwise ; immediate
: endcase ( c: orig1..orign
                postpone drop
                0 ?do postpone then loop ; immediate


Now we can...


: testcase ( n -- )
    case 1 of ." one" endof
              2 of ." two" endof
              otherwise ." a lot"
    endcase ;
[Hey, I said forth is swell. But there isn't a real parser, and if you get
your syntax slightly wrong, rather than parser errors, you get exciting
stack explosions. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.