Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #20622 > unrolled thread

Where to find papers on Forth

Started byEduardo Costa <edu500ac@gmail.com>
First post2013-03-13 03:24 -0700
Last post2013-03-14 17:30 +0100
Articles 5 — 3 participants

Back to article view | Back to comp.lang.forth


Contents

  Where to find papers on Forth Eduardo Costa <edu500ac@gmail.com> - 2013-03-13 03:24 -0700
    Re: Where to find papers on Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-13 13:09 +0100
      Re: Where to find papers on Forth Brad Eckert <hwfwguy@gmail.com> - 2013-03-13 09:50 -0700
      Re: Where to find papers on Forth Eduardo Costa <edu500ac@gmail.com> - 2013-03-14 08:04 -0700
        Re: Where to find papers on Forth Bernd Paysan <bernd.paysan@gmx.de> - 2013-03-14 17:30 +0100

#20622 — Where to find papers on Forth

FromEduardo Costa <edu500ac@gmail.com>
Date2013-03-13 03:24 -0700
SubjectWhere to find papers on Forth
Message-ID<934ce567-c443-4a43-8782-734540bad605@googlegroups.com>
I wonder where people are publishing their papers on Forth. I am particularly fond of papers on Forth because:

(1) Forth papers present complete listings of short applications that do what they claim to do. I found many interesting programs in old papers and books on Forth, and I miss those miniatures and snippets. Here are a few examples:

   Peter Sovietov's implementation of Backus' FP. Published in Russian.
   Brad Rodriguez' bnf
   Noble's Finite State Machines
   Comments for literate programming. I don't know who the author is.
   Lou Odette's implementation of Prolog.
   Auctore Ignoto's Emacs like editor, with macros in Forth. 
      Published in Chinese. I wonder whether Auctore Ignoto knows
      that his alias means "by unknown author", in Latin.
   Samuel Falvo's vibe.f, a vi-like editor
   Jack Park's An approach to natural language parsing

(2) Forth programs are safe. A Forth program seldom crashes due to obscure bugs. Forth compilers almost never have bugs. I thought a lot about this subject. My conclusion is that Forth programs crash so easily, that developers detect bugs during the test phase, and fix them. Then we have an oxymoron: Forth programs never crashes because they crash so easily.

(3) Forth programs are easy to understand, port and modify. Since Forth programs are build around snippets (they are naturally factored), it is easy to test, adapt, and port each functionality, 

To make a long story short, I miss those Journals that used to publish programs in Forth. With the Internet, it is easy to publish on line. Internet also facilitates submission and the work of referees. Therefore, where are Forth programmers publishing their papers?

[toc] | [next] | [standalone]


#20630

FromBernd Paysan <bernd.paysan@gmx.de>
Date2013-03-13 13:09 +0100
Message-ID<khpqa9$3nd$1@online.de>
In reply to#20622
Eduardo Costa wrote:

> I wonder where people are publishing their papers on Forth.

People publish at JFAR (not the much more popular foot&ankle research JFAR 
;-):

http://soton.mpeforth.com/flag/jfar/institute.html

The EuroForth conferences also publish papers (often though, people only 
submit slides for their presentations).

http://www.complang.tuwien.ac.at/anton/euroforth/

> (2) Forth programs are safe. A Forth program seldom crashes due to obscure
> bugs. Forth compilers almost never have bugs. I thought a lot about this
> subject. My conclusion is that Forth programs crash so easily, that
> developers detect bugs during the test phase, and fix them. Then we have
> an oxymoron: Forth programs never crashes because they crash so easily.

Yes, we call that the "crash early, crash often" development style.  When 
the program is actually used, we have a "crash never" mentality.  A crash at 
the user is simply unacceptable.  A crash during development is acceptable, 
but it must be fixed.

Programming is mostly debugging, i.e. finding out why it doesn't work.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [next] | [standalone]


#20641

FromBrad Eckert <hwfwguy@gmail.com>
Date2013-03-13 09:50 -0700
Message-ID<eba4d99c-e7e6-49f0-9fe9-fdd50c257825@googlegroups.com>
In reply to#20630
On Wednesday, March 13, 2013 5:09:42 AM UTC-7, Bernd Paysan wrote:
> Programming is mostly debugging, i.e. finding out why it doesn't work.
> 
And more often than not, debugging the programmer. When you have a broken assumption stuck in your head, it's not easy to get it out.

[toc] | [prev] | [next] | [standalone]


#20664

FromEduardo Costa <edu500ac@gmail.com>
Date2013-03-14 08:04 -0700
Message-ID<f3c94146-5cee-47b3-b9ec-5443d8dbdffc@googlegroups.com>
In reply to#20630
 
> Yes, we call that the "crash early, crash often" development style.  When 
> 
> the program is actually used, we have a "crash never" mentality.  A crash at 
> 
> the user is simply unacceptable.  A crash during development is acceptable, 
> 
> but it must be fixed.
>
> Bernd Paysan
> 
> "If you want it done right, you have to do it yourself"
> 
> http://bernd-paysan.de/

I liked your answer. It is what people call "funny and useful". Thank you. BTW, I looked for programs on your page 

http://bernd-paysan.de/screenful.html

It would be a great service to the Forth community to keep that page active. In particular, it would be great if you could fix Brad Rodriguez' program. The way it is, it does not work on gforth, sp-forth, and bigforth. I guess that this would do the trick:

\ File: br.f
\  : /string  >R R@ - SWAP R> CHARS + SWAP ;
: dp! here - allot ;
0 value matched
: <bnf r> matched if  >in @ here 2>r >r  else  drop  then ; 
: bnf>  r> 2r> matched if  2drop  else dp! >in ! then >r ;
: | r> 2r> matched if  2drop drop  else  2dup dp! >in !
                2>r >r then  true to matched ;
: bnf:   [COMPILE] :  POSTPONE <BNF ; IMMEDIATE
: ;bnf   POSTPONE BNF>  [COMPILE] ; ; IMMEDIATE
: @token ( - n )  source >in @ /string drop c@ ;
: +token ( -- )   matched negate >in +! ;
: =token ( n -- )   @token =  matched and to matched ;
: token ( n "name" -- )  create c, does> c@ =token +token ;
: 0bnf ( -- )  0 source + c!  true to matched ;
: /bnf ( -- )  source nip >in ! ;


It would be great if you agree in providing a link to examples. Of course, the examples don't need to meet the requirement of 16 lines. Here is an example for Brad Rodriguez' parser:

\ File: gchecker.f
S" br.f" included
: tkn create dup c, 0 do dup I + c@ c, loop drop
  does> count 0 do dup I + C@ =token +token loop drop ;
S" cat" tkn <cat>
S" ball" tkn <ball>
bnf: <noun> <cat> | <ball> | ; 
S" the" tkn <the>   S" your" tkn <your>
bnf: <det> <the> | <your> | ;bnf 
0 token <end-of-line> bl token <blank>
bnf: <np>  <det> <blank> <noun>  ;bnf
: parsex 0bnf <np> <end-of-line> /bnf
  cr matched if ." matched " CR 
    else ." failed " CR then ;

parsex your cat
bye


~/frt/gforth-0.7.0$ rlwrap ./gforth gchecker.f 

matched 


~/frt/bigforth$ ./bigforth gchecker.f 

matched 

The program works fine for sp-forth if one adds caseins.f and uncomment the definition of /string

~/frt/spf$ ./spf4 lib/ext/caseins.f gchecker.f 

matched 

I fetched the above example from a program written by Junia Magellans. Of course, her grammar is much larger than my miniature example,  but much more interesting too. My suggestion is that the examples don't obey the one screen-full rule.

To make a long story short, your idea of providing a screen of Forth is great, and you should update the page often. 


[toc] | [prev] | [next] | [standalone]


#20667

FromBernd Paysan <bernd.paysan@gmx.de>
Date2013-03-14 17:30 +0100
Message-ID<khstvf$d2l$1@online.de>
In reply to#20664
Eduardo Costa wrote:
> It would be a great service to the Forth community to keep that page
> active. In particular, it would be great if you could fix Brad Rodriguez'
> program. The way it is, it does not work on gforth, sp-forth, and
> bigforth. I guess that this would do the trick:

I try to stay as close to the original as possible.  The version I've online 
does work in Gforth and bigForth.  Don't know about sp-Forth.  The only non-
standard word in there is recursive.

> It would be great if you agree in providing a link to examples. Of course,
> the examples don't need to meet the requirement of 16 lines. Here is an
> example for Brad Rodriguez' parser:

That example doesn't use the original parser, and needs fixing.  This 
version works, and it doesn't use the bad idea of a 0 terminator outside the 
input buffer.

\ BNF example
include bnf.fs
: 0bnf ( -- )  true success ! ;
: /bnf ( -- )  source nip >in ! ;
: tkn create dup c, bounds ?do I c@ c, loop
  does> count bounds ?do I C@ =token loop ;
S" cat" tkn <cat>
S" ball" tkn <ball>
bnf: <noun> <cat> | <ball> | ; 
S" the" tkn <the>   S" your" tkn <your>
bnf: <det> <the> | <your> | ;bnf 
: <end-of-line> source nip >in @ = success ! ;
bl token <blank>
bnf: <np>  <det> <blank> <noun>  ;bnf
: parsex 0bnf <np> <end-of-line> /bnf
  cr success @ if ." matched " CR 
  else ." failed " CR then ;

parsex your cat
parsex the ball

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.forth


csiph-web