Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Natural laws have no pity.


devel / comp.lang.forth / Interpreters and parsing in Forth

SubjectAuthor
* Interpreters and parsing in Forthnone
`* Re: Interpreters and parsing in ForthZbig
 `* Re: Interpreters and parsing in Forthdxforth
  +* Re: Interpreters and parsing in ForthMarcel Hendrix
  |`* Re: Interpreters and parsing in Forthdxforth
  | +* Re: Interpreters and parsing in ForthMarcel Hendrix
  | |`* Re: Interpreters and parsing in Forthdxforth
  | | +- Re: Interpreters and parsing in ForthMarcel Hendrix
  | | `- Re: Interpreters and parsing in Forthminf...@arcor.de
  | `* Re: Interpreters and parsing in ForthAnton Ertl
  |  +- Re: Interpreters and parsing in ForthMarcel Hendrix
  |  `- Re: Interpreters and parsing in ForthAndy Valencia
  `* Re: Interpreters and parsing in Forthnone
   `- Re: Interpreters and parsing in Forthdxforth

1
Interpreters and parsing in Forth

<nnd$3b48eac0$6330e829@59c7929855e9db21>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17407&group=comp.lang.forth#17407

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: Interpreters and parsing in Forth
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$3b48eac0$6330e829@59c7929855e9db21>
Organization: KPN B.V.
Date: Tue, 29 Mar 2022 12:38:20 +0200
Path: i2pn2.org!i2pn.org!news.swapon.de!news.uzoreto.com!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!feeder1.feed.usenet.farm!feed.usenet.farm!feed.abavia.com!abe004.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 148
Injection-Date: Tue, 29 Mar 2022 12:38:20 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: none - Tue, 29 Mar 2022 10:38 UTC

I hate seeing separate parsers/interpreters written in Forth.
The following is an example to show how easy it can be done,
**but it is not supposedly a portable program **.

The first part within ---- is the only addition ciforth needs
to understand for example pascal programs up to lexical analysis.
The crux is revector NAME that takes the place of WORD and the
word PREFIX that foregoes the need space separated keywords
(that look silly in pascal).
-------------------------------------------------------------
\ NOTE: Charles Moore convention for parameters. (Extra spaces
\ around parameters.) A verb surrounded by spaces denotes truth.
\ Example of an uglified stack comment:
\ For a char return : a (Pascal) word may start with this.
\ ( char -- flag )

\ Return the address just past the parse area.
\ ( -- address ) \ uglified
: EOP SRC CELL+ @ ;

\ Push back the parse pointer by one character.
\ ( -- ) \ uglified
: PP-- -1 PP +! ;

\ All delimiters are prefixes, i.e. they do their own parsing.
DATA delimiters 0 , 128 ALLOT

\ For a char return : a (Pascal) word may start with this.
\ Now do the uglifying yourself.
: ?START delimiters $@ ROT $^ 0<> ;

\ A name now starts with the next non-blank, but ends on a blank
\ or delimiter. Return token , a string constant.
: TOKEN
\ Find first non-blank
_ BEGIN DROP PP@@ ?BLANK NOT OVER EOP = OR UNTIL
\ If we are at starter, return whole parse area.
DUP C@ ?START IF EOP OVER - EXIT THEN
\ A token ends at a blnk or the next delimiter
_ BEGIN DROP PP@@ DUP ?BLANK SWAP ?START OR UNTIL
\ A delimiter is not part of the current token
DUP C@ ?START IF PP-- THEN
\ start end --> stringconstant
OVER - ;
'TOKEN 'NAME 2 CELLS MOVE

-----------------------------------------------------------------------
Example, by Hopkins test convention:
{ : pascal-delimiters ":[](){};" ; -> }
{ pascal-delimiters delimiters $! -> }
{ BL ?START &A ?START &[ ?START -> FALSE FALSE TRUE }
{ 0 delimiters ! -> }

\ This is the existing definition for NAME as a reference.
\ Return next word from the input stream. ( -- add len)
: NAME2
_ BEGIN DROP PP@@ ?BLANK NOT OVER EOP = OR UNTIL \ ( -- start )
_ BEGIN DROP PP@@ ?BLANK UNTIL \ ( -- start end )
OVER - ;
---------------------------------
\ Now introduce some auxiliary definitions, thunks,
\ the pascal goes to the level of lexical analysis.
\ The thunks show that the analysis is correct.

\ For body of `CREATE word, return name of that word.
: $ego BODY> >NFA @ $@ ;

\ Define some (Pascal or other) keyword.
: some-keyword CREATE DOES> $ego "|" TYPE TYPE "|" TYPE CR ;

\ Apply xt (a defining word) to all names on the same line.
: a_row: ^J PARSE SAVE SET-SRC BEGIN DUP CATCH UNTIL DROP RESTORE ;
\ With xt (just a word) use all names on the same line to define an alias.
: aliases:
^J PARSE SAVE SET-SRC BEGIN DUP 'ALIAS CATCH UNTIL 2DROP RESTORE ;

-------------------------------------------
Parsing pascal goes as follows:

NAMESPACE pascal
INCLUDE pascal.frt

\ Parse a string with only words from `pascal defined.
\ Those words define what actually happens.
: parse-pascal pascal-delimiters delimiters $!
pascal EVALUATE PREVIOUS 0 delimiters ! ;

-----------------------------------
This is the lexer for pascal. It has been tested by
analysing a lisp implementation in pascal.

\ $Id: pascal.frt,v 1.13 2017/05/30 22:11:03 albert Exp $
\ Copyright (2016): Albert van der Horst {by GNU Public License version 2}
\ Protected by GPL, quality but no warranty.
\ Definition of Pascal tokenizer, part of the alif project.

: pascal-delimiters "-+*/=<>:;.{}()[]," ;
\ Print class and identification of token.
: .cl+id TYPE ": " TYPE TYPE CR ;

: keyword CREATE DOES> $ego "Keyword" .cl+id ;
: keyword-decl CREATE DOES> $ego "Keyword-decl" .cl+id ;
: ascii-operator CREATE DOES> $ego "Operator keyword" .cl+id ;
: operator CREATE PREFIX DOES> $ego "operator" .cl+id ;
: interpunction CREATE PREFIX DOES> $ego "Interpunction" .cl+id ;
: bracket CREATE PREFIX DOES> $ego "Bracket" .cl+id ;
: number -1 PP +! TOKEN "Number" .cl+id ; PREFIX

pascal DEFINITIONS PREVIOUS \ Make `pascal CURRENT/
: catch-all TOKEN "Identifier" .cl+id ; PREFIX
LATEST >NFA \ Keep on stack to seal the wordlist
'FORTH ALIAS FORTH
'keyword a_row: program begin end procedure function var const
'keyword a_row: if then else do while elsif repeat until
'keyword-decl a_row: packed array of label
'ascii-operator a_row: and or mod div not
'number aliases: 0 1 2 3 4 5 6 7 8 9
'interpunction a_row: . ; : , ..
'operator a_row: - + * /
'operator a_row: = < >
\ Two char operators must hide single char operators/interpunction.
'operator a_row: <> <= >= :=
'bracket a_row: [ ] ( )
: { &} PARSE "Comment" .cl+id ; PREFIX
: ' &' PARSE "String: " TYPE &' EMIT TYPE &' EMIT CR ; PREFIX
: (* "comment(*" TYPE CR
PP @ BEGIN &* PARSE 2DROP PP@@ NIP &) = UNTIL
PP @ OVER - 2 - TYPE CR "*)comment" TYPE CR ; PREFIX
\ Seal the pascal namespace using the address left on the stack,
\ by voiding catch-all's name
HERE 0 , ( nfa emptystring -- ) SWAP !
DEFINITIONS
: pWORDS pascal WORDS PREVIOUS ;
--------------------------------------

Sorry for shouting.

FORTH IS ITS OWN INTERPRETER.
IMPLEMENTING AN INTERPRETER IN FORTH IS AN ABOMINATION.

Groetjes.
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Re: Interpreters and parsing in Forth

<098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18139&group=comp.lang.forth#18139

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a37:a385:0:b0:6a3:2baf:7e98 with SMTP id m127-20020a37a385000000b006a32baf7e98mr42831477qke.109.1654018909423;
Tue, 31 May 2022 10:41:49 -0700 (PDT)
X-Received: by 2002:ac8:5a11:0:b0:304:bab8:66f3 with SMTP id
n17-20020ac85a11000000b00304bab866f3mr3761688qta.388.1654018909251; Tue, 31
May 2022 10:41:49 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Tue, 31 May 2022 10:41:49 -0700 (PDT)
In-Reply-To: <nnd$3b48eac0$6330e829@59c7929855e9db21>
Injection-Info: google-groups.googlegroups.com; posting-host=2a02:a31d:a141:5b00:3176:cc50:14b9:1f4a;
posting-account=cxuXKwoAAABQpPOMD55A9IPz7pPrw6ml
NNTP-Posting-Host: 2a02:a31d:a141:5b00:3176:cc50:14b9:1f4a
References: <nnd$3b48eac0$6330e829@59c7929855e9db21>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
Subject: Re: Interpreters and parsing in Forth
From: zbigniew...@gmail.com (Zbig)
Injection-Date: Tue, 31 May 2022 17:41:49 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1564
 by: Zbig - Tue, 31 May 2022 17:41 UTC

> FORTH IS ITS OWN INTERPRETER.
> IMPLEMENTING AN INTERPRETER IN FORTH IS AN ABOMINATION.

I wonder if on that rule one could implement Forth-specific (even simple)
filesystem, using existing dictionary facility (I mean „its logic”). You know:
creating a file as analogy to word creation, create (sub)directory = create
vocabulary etc.

Re: Interpreters and parsing in Forth

<t7971l$1csa$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18161&group=comp.lang.forth#18161

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Interpreters and parsing in Forth
Date: Thu, 2 Jun 2022 12:24:53 +1000
Organization: Aioe.org NNTP Server
Message-ID: <t7971l$1csa$1@gioia.aioe.org>
References: <nnd$3b48eac0$6330e829@59c7929855e9db21>
<098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="45962"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Thu, 2 Jun 2022 02:24 UTC

On 1/06/2022 04:47, minf...@arcor.de wrote:
> Zbig schrieb am Dienstag, 31. Mai 2022 um 19:41:50 UTC+2:
>> > FORTH IS ITS OWN INTERPRETER.
>> > IMPLEMENTING AN INTERPRETER IN FORTH IS AN ABOMINATION.
>> I wonder if on that rule one could implement Forth-specific (even simple)
>> filesystem, using existing dictionary facility (I mean „its logic”). You know:
>> creating a file as analogy to word creation, create (sub)directory = create
>> vocabulary etc.
>
> Just take it as tongue-in-cheek comment. After all Forth is a wonderful tool
> to build your own DSL interpreter.

Even better if one can avoid it. Moore once wrote a BASIC compiler in Forth.
Was everyone impressed? Yes - but a lot of effort for something neither he
nor they actually needed.

Re: Interpreters and parsing in Forth

<776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18162&group=comp.lang.forth#18162

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:40c2:b0:6a3:7a56:b282 with SMTP id g2-20020a05620a40c200b006a37a56b282mr2019802qko.408.1654147066690;
Wed, 01 Jun 2022 22:17:46 -0700 (PDT)
X-Received: by 2002:a05:6214:20e6:b0:45d:403f:7a90 with SMTP id
6-20020a05621420e600b0045d403f7a90mr57046075qvk.1.1654147066573; Wed, 01 Jun
2022 22:17:46 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Wed, 1 Jun 2022 22:17:46 -0700 (PDT)
In-Reply-To: <t7971l$1csa$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:6def:88f3:d8e5:973c;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:6def:88f3:d8e5:973c
References: <nnd$3b48eac0$6330e829@59c7929855e9db21> <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com> <t7971l$1csa$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com>
Subject: Re: Interpreters and parsing in Forth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Thu, 02 Jun 2022 05:17:46 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2451
 by: Marcel Hendrix - Thu, 2 Jun 2022 05:17 UTC

On Thursday, June 2, 2022 at 4:24:56 AM UTC+2, dxforth wrote:
> On 1/06/2022 04:47, minf...@arcor.de wrote:
> > Zbig schrieb am Dienstag, 31. Mai 2022 um 19:41:50 UTC+2:
> >> > FORTH IS ITS OWN INTERPRETER.
> >> > IMPLEMENTING AN INTERPRETER IN FORTH IS AN ABOMINATION.
> >> I wonder if on that rule one could implement Forth-specific (even simple)
> >> filesystem, using existing dictionary facility (I mean „its logic”). You know:
> >> creating a file as analogy to word creation, create (sub)directory = create
> >> vocabulary etc.
> >
> > Just take it as tongue-in-cheek comment. After all Forth is a wonderful tool
> > to build your own DSL interpreter.
> Even better if one can avoid it. Moore once wrote a BASIC compiler in Forth.
> Was everyone impressed? Yes - but a lot of effort for something neither he
> nor they actually needed.

The most sophisticated tools I know (MATLAB, Octave, Scilab, NGSPICE,
Mathematica, ...) have some kind of interpreter on board. It makes using
them extremely easy and convenient.

-marcel

Re: Interpreters and parsing in Forth

<t79lrj$1nt8$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18163&group=comp.lang.forth#18163

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Interpreters and parsing in Forth
Date: Thu, 2 Jun 2022 16:37:38 +1000
Organization: Aioe.org NNTP Server
Message-ID: <t79lrj$1nt8$1@gioia.aioe.org>
References: <nnd$3b48eac0$6330e829@59c7929855e9db21>
<098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com>
<t7971l$1csa$1@gioia.aioe.org>
<776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="57256"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Thu, 2 Jun 2022 06:37 UTC

On 2/06/2022 15:17, Marcel Hendrix wrote:
> On Thursday, June 2, 2022 at 4:24:56 AM UTC+2, dxforth wrote:
>> On 1/06/2022 04:47, minf...@arcor.de wrote:
>> > Zbig schrieb am Dienstag, 31. Mai 2022 um 19:41:50 UTC+2:
>> >> > FORTH IS ITS OWN INTERPRETER.
>> >> > IMPLEMENTING AN INTERPRETER IN FORTH IS AN ABOMINATION.
>> >> I wonder if on that rule one could implement Forth-specific (even simple)
>> >> filesystem, using existing dictionary facility (I mean „its logic”). You know:
>> >> creating a file as analogy to word creation, create (sub)directory = create
>> >> vocabulary etc.
>> >
>> > Just take it as tongue-in-cheek comment. After all Forth is a wonderful tool
>> > to build your own DSL interpreter.
>> Even better if one can avoid it. Moore once wrote a BASIC compiler in Forth.
>> Was everyone impressed? Yes - but a lot of effort for something neither he
>> nor they actually needed.
>
> The most sophisticated tools I know (MATLAB, Octave, Scilab, NGSPICE,
> Mathematica, ...) have some kind of interpreter on board. It makes using
> them extremely easy and convenient.

By sophisticated you mean complicated? You do all the hard work so that
others can have it easy. Either one is getting handsomely paid for it -
or it's a labour of love :)

Re: Interpreters and parsing in Forth

<944f7c6a-d8e4-4fd7-964b-b62a3e5bad45n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18164&group=comp.lang.forth#18164

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:1a19:b0:6a5:dad3:303b with SMTP id bk25-20020a05620a1a1900b006a5dad3303bmr2369695qkb.680.1654160042895;
Thu, 02 Jun 2022 01:54:02 -0700 (PDT)
X-Received: by 2002:a37:9ece:0:b0:6a6:7056:d836 with SMTP id
h197-20020a379ece000000b006a67056d836mr2294905qke.49.1654160042758; Thu, 02
Jun 2022 01:54:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 2 Jun 2022 01:54:02 -0700 (PDT)
In-Reply-To: <t79lrj$1nt8$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=176.74.235.101; posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 176.74.235.101
References: <nnd$3b48eac0$6330e829@59c7929855e9db21> <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com> <t7971l$1csa$1@gioia.aioe.org>
<776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com> <t79lrj$1nt8$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <944f7c6a-d8e4-4fd7-964b-b62a3e5bad45n@googlegroups.com>
Subject: Re: Interpreters and parsing in Forth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Thu, 02 Jun 2022 08:54:02 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2135
 by: Marcel Hendrix - Thu, 2 Jun 2022 08:54 UTC

On Thursday, June 2, 2022 at 8:37:42 AM UTC+2, dxforth wrote:
> On 2/06/2022 15:17, Marcel Hendrix wrote:
> > On Thursday, June 2, 2022 at 4:24:56 AM UTC+2, dxforth wrote:
[..]
> > The most sophisticated tools I know (MATLAB, Octave, Scilab, NGSPICE,
> > Mathematica, ...) have some kind of interpreter on board. It makes using
> > them extremely easy and convenient.
> By sophisticated you mean complicated? You do all the hard work so that
> others can have it easy. Either one is getting handsomely paid for it -
> or it's a labour of love :)

A side-benefit of having an interpreter is that they have to open up their API,
and keep it that way. Most of the algorithms are based on open source
anyway, but it saves me a lot of time just looking at it or copying bits and
pieces.

-macel

Re: Interpreters and parsing in Forth

<nnd$7c2974c2$7c459bc0@8f0df32246471677>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18166&group=comp.lang.forth#18166

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
References: <nnd$3b48eac0$6330e829@59c7929855e9db21> <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com> <8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com> <t7971l$1csa$1@gioia.aioe.org>
Subject: Re: Interpreters and parsing in Forth
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: alb...@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$7c2974c2$7c459bc0@8f0df32246471677>
Organization: KPN B.V.
Date: Thu, 02 Jun 2022 11:40:42 +0200
Path: i2pn2.org!i2pn.org!news.swapon.de!news.uzoreto.com!feeder.usenetexpress.com!tr1.eu1.usenetexpress.com!94.232.112.244.MISMATCH!feed.abavia.com!abe004.abavia.com!abp003.abavia.com!news.kpn.nl!not-for-mail
Lines: 28
Injection-Date: Thu, 02 Jun 2022 11:40:42 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
 by: none - Thu, 2 Jun 2022 09:40 UTC

In article <t7971l$1csa$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
>On 1/06/2022 04:47, minf...@arcor.de wrote:
>> Zbig schrieb am Dienstag, 31. Mai 2022 um 19:41:50 UTC+2:
>>> > FORTH IS ITS OWN INTERPRETER.
>>> > IMPLEMENTING AN INTERPRETER IN FORTH IS AN ABOMINATION.
>>> I wonder if on that rule one could implement Forth-specific (even simple)
>>> filesystem, using existing dictionary facility (I mean „its
>logic”). You know:
>>> creating a file as analogy to word creation, create (sub)directory = create
>>> vocabulary etc.
>>
>> Just take it as tongue-in-cheek comment. After all Forth is a wonderful tool
>> to build your own DSL interpreter.
>
>Even better if one can avoid it. Moore once wrote a BASIC compiler in Forth.
>Was everyone impressed? Yes - but a lot of effort for something neither he
>nor they actually needed.

I guessed that the BASIC compiler originated from Moore himself,
but I found no confirmation of that. What is you source of information?

Groetjes Albert
--
"in our communism country Viet Nam, people are forced to be
alive and in the western country like US, people are free to
die from Covid 19 lol" duc ha
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

Re: Interpreters and parsing in Forth

<t7bp8p$skv$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18177&group=comp.lang.forth#18177

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Interpreters and parsing in Forth
Date: Fri, 3 Jun 2022 11:48:09 +1000
Organization: Aioe.org NNTP Server
Message-ID: <t7bp8p$skv$1@gioia.aioe.org>
References: <nnd$3b48eac0$6330e829@59c7929855e9db21>
<098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com>
<t7971l$1csa$1@gioia.aioe.org> <nnd$7c2974c2$7c459bc0@8f0df32246471677>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: gioia.aioe.org; logging-data="29343"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-GB
 by: dxforth - Fri, 3 Jun 2022 01:48 UTC

On 2/06/2022 19:40, albert wrote:
> In article <t7971l$1csa$1@gioia.aioe.org>, dxforth <dxforth@gmail.com> wrote:
>>On 1/06/2022 04:47, minf...@arcor.de wrote:
>>> Zbig schrieb am Dienstag, 31. Mai 2022 um 19:41:50 UTC+2:
>>>> > FORTH IS ITS OWN INTERPRETER.
>>>> > IMPLEMENTING AN INTERPRETER IN FORTH IS AN ABOMINATION.
>>>> I wonder if on that rule one could implement Forth-specific (even simple)
>>>> filesystem, using existing dictionary facility (I mean „its
>>logic”). You know:
>>>> creating a file as analogy to word creation, create (sub)directory = create
>>>> vocabulary etc.
>>>
>>> Just take it as tongue-in-cheek comment. After all Forth is a wonderful tool
>>> to build your own DSL interpreter.
>>
>>Even better if one can avoid it. Moore once wrote a BASIC compiler in Forth.
>>Was everyone impressed? Yes - but a lot of effort for something neither he
>>nor they actually needed.
>
> I guessed that the BASIC compiler originated from Moore himself,
> but I found no confirmation of that. What is you source of information?

FD V3N6 "Charles Moore's Basic Compiler Revisited" - M. Perry

It references Moore's "BASIC Compiler in FORTH" FORML Proceedings 1981

Re: Interpreters and parsing in Forth

<t7btg2$5vs$1@gioia.aioe.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18178&group=comp.lang.forth#18178

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxfo...@gmail.com (dxforth)
Newsgroups: comp.lang.forth
Subject: Re: Interpreters and parsing in Forth
Date: Fri, 3 Jun 2022 13:00:18 +1000
Organization: Aioe.org NNTP Server
Message-ID: <t7btg2$5vs$1@gioia.aioe.org>
References: <nnd$3b48eac0$6330e829@59c7929855e9db21>
<098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com>
<t7971l$1csa$1@gioia.aioe.org>
<776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com>
<t79lrj$1nt8$1@gioia.aioe.org>
<944f7c6a-d8e4-4fd7-964b-b62a3e5bad45n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="6140"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
 by: dxforth - Fri, 3 Jun 2022 03:00 UTC

On 2/06/2022 18:54, Marcel Hendrix wrote:
> On Thursday, June 2, 2022 at 8:37:42 AM UTC+2, dxforth wrote:
>> On 2/06/2022 15:17, Marcel Hendrix wrote:
>> > On Thursday, June 2, 2022 at 4:24:56 AM UTC+2, dxforth wrote:
> [..]
>> > The most sophisticated tools I know (MATLAB, Octave, Scilab, NGSPICE,
>> > Mathematica, ...) have some kind of interpreter on board. It makes using
>> > them extremely easy and convenient.
>> By sophisticated you mean complicated? You do all the hard work so that
>> others can have it easy. Either one is getting handsomely paid for it -
>> or it's a labour of love :)
>
> A side-benefit of having an interpreter is that they have to open up their API,
> and keep it that way. Most of the algorithms are based on open source
> anyway, but it saves me a lot of time just looking at it or copying bits and
> pieces.

I'm all for other folk writing and maintaining programs for the masses
as it leaves me free to write the small things I need, as I please.

But why go down the hard path of emulating the MATLABs and SPICE in
Forth if those tools already exist? Are they flawed? When I began
my forth compiler, the systems I could afford were rather miserable
so I felt some justification. OTOH I severely miscalculated both
the time it would take and my ability.

Re: Interpreters and parsing in Forth

<1e75a112-b48e-4bbe-b425-6c7b9fe4b1c7n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18180&group=comp.lang.forth#18180

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:620a:2402:b0:6a5:3b28:d726 with SMTP id d2-20020a05620a240200b006a53b28d726mr5366173qkn.500.1654233809111;
Thu, 02 Jun 2022 22:23:29 -0700 (PDT)
X-Received: by 2002:a05:622a:1805:b0:2fc:ca5e:7b8c with SMTP id
t5-20020a05622a180500b002fcca5e7b8cmr6227418qtc.429.1654233808983; Thu, 02
Jun 2022 22:23:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 2 Jun 2022 22:23:28 -0700 (PDT)
In-Reply-To: <t7btg2$5vs$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2001:1c05:2f14:600:50b5:d797:94cb:3ac4;
posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 2001:1c05:2f14:600:50b5:d797:94cb:3ac4
References: <nnd$3b48eac0$6330e829@59c7929855e9db21> <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com> <t7971l$1csa$1@gioia.aioe.org>
<776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com> <t79lrj$1nt8$1@gioia.aioe.org>
<944f7c6a-d8e4-4fd7-964b-b62a3e5bad45n@googlegroups.com> <t7btg2$5vs$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1e75a112-b48e-4bbe-b425-6c7b9fe4b1c7n@googlegroups.com>
Subject: Re: Interpreters and parsing in Forth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Fri, 03 Jun 2022 05:23:29 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1908
 by: Marcel Hendrix - Fri, 3 Jun 2022 05:23 UTC

On Friday, June 3, 2022 at 5:00:23 AM UTC+2, dxforth wrote:
[..]
> But why go down the hard path of emulating the MATLABs and
> SPICE in Forth if those tools already exist? Are they flawed?

Well, in my view, yes.

And I don't emulate them, I use them by sending a few lines
of text and catch the output (or access their API).

Are all the tools we use just perfect and is there
nothing in them that even slightly bothers us?

-marcel

Re: Interpreters and parsing in Forth

<65f29201-832e-46de-a753-bcb23ba2527an@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18181&group=comp.lang.forth#18181

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:ac8:5b51:0:b0:304:d815:bfd0 with SMTP id n17-20020ac85b51000000b00304d815bfd0mr4211200qtw.287.1654239502116;
Thu, 02 Jun 2022 23:58:22 -0700 (PDT)
X-Received: by 2002:a05:622a:1805:b0:2fc:ca5e:7b8c with SMTP id
t5-20020a05622a180500b002fcca5e7b8cmr6373439qtc.429.1654239501967; Thu, 02
Jun 2022 23:58:21 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Thu, 2 Jun 2022 23:58:21 -0700 (PDT)
In-Reply-To: <t7btg2$5vs$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2003:f7:1f29:3a0d:e8ed:e70:63f:907f;
posting-account=AqNUYgoAAADmkK2pN-RKms8sww57W0Iw
NNTP-Posting-Host: 2003:f7:1f29:3a0d:e8ed:e70:63f:907f
References: <nnd$3b48eac0$6330e829@59c7929855e9db21> <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com> <t7971l$1csa$1@gioia.aioe.org>
<776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com> <t79lrj$1nt8$1@gioia.aioe.org>
<944f7c6a-d8e4-4fd7-964b-b62a3e5bad45n@googlegroups.com> <t7btg2$5vs$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <65f29201-832e-46de-a753-bcb23ba2527an@googlegroups.com>
Subject: Re: Interpreters and parsing in Forth
From: minfo...@arcor.de (minf...@arcor.de)
Injection-Date: Fri, 03 Jun 2022 06:58:22 +0000
Content-Type: text/plain; charset="UTF-8"
 by: minf...@arcor.de - Fri, 3 Jun 2022 06:58 UTC

dxforth schrieb am Freitag, 3. Juni 2022 um 05:00:23 UTC+2:
> On 2/06/2022 18:54, Marcel Hendrix wrote:
> > On Thursday, June 2, 2022 at 8:37:42 AM UTC+2, dxforth wrote:
> >> On 2/06/2022 15:17, Marcel Hendrix wrote:
> >> > On Thursday, June 2, 2022 at 4:24:56 AM UTC+2, dxforth wrote:
> > [..]
> >> > The most sophisticated tools I know (MATLAB, Octave, Scilab, NGSPICE,
> >> > Mathematica, ...) have some kind of interpreter on board. It makes using
> >> > them extremely easy and convenient.
> >> By sophisticated you mean complicated? You do all the hard work so that
> >> others can have it easy. Either one is getting handsomely paid for it -
> >> or it's a labour of love :)
> >
> > A side-benefit of having an interpreter is that they have to open up their API,
> > and keep it that way. Most of the algorithms are based on open source
> > anyway, but it saves me a lot of time just looking at it or copying bits and
> > pieces.
> I'm all for other folk writing and maintaining programs for the masses
> as it leaves me free to write the small things I need, as I please.
>
> But why go down the hard path of emulating the MATLABs and SPICE in
> Forth if those tools already exist? Are they flawed? When I began
> my forth compiler, the systems I could afford were rather miserable
> so I felt some justification. OTOH I severely miscalculated both
> the time it would take and my ability.

I used a linear algebra DSL in Forth for adaptive filter coefficient
calculation in the loop. A descendant of Kalman filters.

The DSL emulates classic Matlab syntax as far as it makes sense.
It couldn't have been done with Matlab coder or compiler.

Re: Interpreters and parsing in Forth

<2022Jun3.123744@mips.complang.tuwien.ac.at>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18184&group=comp.lang.forth#18184

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ant...@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.lang.forth
Subject: Re: Interpreters and parsing in Forth
Date: Fri, 03 Jun 2022 10:37:44 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
Lines: 20
Message-ID: <2022Jun3.123744@mips.complang.tuwien.ac.at>
References: <nnd$3b48eac0$6330e829@59c7929855e9db21> <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com> <8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com> <t7971l$1csa$1@gioia.aioe.org> <776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com> <t79lrj$1nt8$1@gioia.aioe.org>
Injection-Info: reader02.eternal-september.org; posting-host="34907eb5e28bc99e44ece0f37b0f96ff";
logging-data="8664"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19586Ew+0ekzNt4mxZ+X1ty"
Cancel-Lock: sha1:xHsofLrmN4ufnrDcBPLm2sKtYcE=
X-newsreader: xrn 10.00-beta-3
 by: Anton Ertl - Fri, 3 Jun 2022 10:37 UTC

dxforth <dxforth@gmail.com> writes:
>On 2/06/2022 15:17, Marcel Hendrix wrote:
>> The most sophisticated tools I know (MATLAB, Octave, Scilab, NGSPICE,
>> Mathematica, ...) have some kind of interpreter on board.

And if the interpreter is not designed in from the start, it still
appears in an ad-hoc form, according to Greenspun's tenth rule.

>You do all the hard work so that
>others can have it easy.

Division of labour and toolmaking are new concepts? [Meta: Oh boy,
dxforth's style of "discussion" is contagious.]

- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2022: http://www.euroforth.org/ef22/cfp.html

Re: Interpreters and parsing in Forth

<933d5c6b-a792-4e08-8946-b473e3a6dc87n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18185&group=comp.lang.forth#18185

  copy link   Newsgroups: comp.lang.forth
X-Received: by 2002:a05:622a:183:b0:301:b1a6:2383 with SMTP id s3-20020a05622a018300b00301b1a62383mr6936257qtw.42.1654255917004;
Fri, 03 Jun 2022 04:31:57 -0700 (PDT)
X-Received: by 2002:a05:622a:388:b0:304:e380:451d with SMTP id
j8-20020a05622a038800b00304e380451dmr44433qtx.265.1654255916854; Fri, 03 Jun
2022 04:31:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.forth
Date: Fri, 3 Jun 2022 04:31:56 -0700 (PDT)
In-Reply-To: <2022Jun3.123744@mips.complang.tuwien.ac.at>
Injection-Info: google-groups.googlegroups.com; posting-host=176.74.235.101; posting-account=-JQ2RQoAAAB6B5tcBTSdvOqrD1HpT_Rk
NNTP-Posting-Host: 176.74.235.101
References: <nnd$3b48eac0$6330e829@59c7929855e9db21> <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com>
<8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com> <t7971l$1csa$1@gioia.aioe.org>
<776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com> <t79lrj$1nt8$1@gioia.aioe.org>
<2022Jun3.123744@mips.complang.tuwien.ac.at>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <933d5c6b-a792-4e08-8946-b473e3a6dc87n@googlegroups.com>
Subject: Re: Interpreters and parsing in Forth
From: mhx...@iae.nl (Marcel Hendrix)
Injection-Date: Fri, 03 Jun 2022 11:31:56 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Marcel Hendrix - Fri, 3 Jun 2022 11:31 UTC

On Friday, June 3, 2022 at 12:44:33 PM UTC+2, Anton Ertl wrote:
[..]
> And if the interpreter is not designed in from the start, it still
> appears in an ad-hoc form, according to Greenspun's tenth rule.

"Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified,
bug-ridden, slow implementation of half of Common Lisp."

*Exactly* on point for NGSPICE :--(

-marcel

Re: Interpreters and parsing in Forth

<165426686371.11910.16382261397754162660@media.vsta.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=18187&group=comp.lang.forth#18187

  copy link   Newsgroups: comp.lang.forth
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: van...@vsta.org (Andy Valencia)
Newsgroups: comp.lang.forth
Subject: Re: Interpreters and parsing in Forth
Date: Fri, 03 Jun 2022 07:34:23 -0700
Lines: 12
Message-ID: <165426686371.11910.16382261397754162660@media.vsta.org>
References: <933d5c6b-a792-4e08-8946-b473e3a6dc87n@googlegroups.com> <nnd$3b48eac0$6330e829@59c7929855e9db21> <098abaad-13b6-4cb0-ae59-cdd633f8d6d6n@googlegroups.com> <8b6ced49-f0c0-4fcf-86ea-7897f1b5ec09n@googlegroups.com> <t7971l$1csa$1@gioia.aioe.org> <776e853a-b9c3-4df2-9e54-eb975b4d4fa1n@googlegroups.com> <t79lrj$1nt8$1@gioia.aioe.org> <2022Jun3.123744@mips.complang.tuwien.ac.at>
X-Trace: individual.net SyslAfjDaexUOGkOtvgxEQ2o3J18ajgZzTZH3S+zNmz/EA3xdX
X-Orig-Path: media
Cancel-Lock: sha1:SBH4aQxBrcXCi9EGBZvXDJM99Ls=
User-Agent: rn.py v0.0.1
 by: Andy Valencia - Fri, 3 Jun 2022 14:34 UTC

Marcel Hendrix <mhx@iae.nl> writes:
> On Friday, June 3, 2022 at 12:44:33 PM UTC+2, Anton Ertl wrote:
> [..]
> "Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified,
> bug-ridden, slow implementation of half of Common Lisp."

We found the same thing, but for programs which do search-for-solution.
In that case, the same statement applies, except "Lisp" -> "Prolog".

Andy Valencia
Home page: https://www.vsta.org/andy/
To contact me: https://www.vsta.org/contact/andy.html

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor