Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #51794 > unrolled thread
| Started by | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| First post | 2016-10-12 16:00 +0200 |
| Last post | 2016-10-19 14:32 +0200 |
| Articles | 20 on this page of 24 — 12 participants |
Back to article view | Back to comp.lang.forth
Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-12 16:00 +0200
Re: Basic in Forth: an old gem trans <transfire@gmail.com> - 2016-10-12 10:19 -0700
Re: Basic in Forth: an old gem "Ed" <invalid@nospam.com> - 2016-10-13 10:50 +1000
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-13 03:24 +0200
Re: Basic in Forth: an old gem "Ed" <invalid@nospam.com> - 2016-10-13 12:51 +1000
Re: Basic in Forth: an old gem Hans Bezemer <the.beez.speaks@gmail.com> - 2016-10-13 17:41 +0200
Re: Basic in Forth: an old gem mhx@iae.nl - 2016-10-12 11:37 -0700
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-12 21:20 +0200
Re: Basic in Forth: an old gem Mark Wills <markwills1970@gmail.com> - 2016-10-13 05:01 -0700
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-13 14:27 +0200
Re: Basic in Forth: an old gem Coos Haak <htrofhc@gmail.com> - 2016-10-13 16:27 +0200
Re: Basic in Forth: an old gem hughaguilar96@gmail.com - 2016-10-13 14:08 -0700
Re: Basic in Forth: an old gem Lars Brinkhoff <lars.spam@nocrew.org> - 2016-10-14 07:26 +0200
Re: Basic in Forth: an old gem hughaguilar96@gmail.com - 2016-10-14 01:07 -0700
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-14 00:48 +0200
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-16 11:49 +0200
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-16 21:16 +0200
Re: Basic in Forth: an old gem jim <anon@example.com> - 2016-10-17 00:37 +0100
Re: Basic in Forth: an old gem foxaudioresearch@gmail.com - 2016-10-18 12:02 -0700
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-18 15:51 +0200
Re: Basic in Forth: an old gem Doug Hoffman <glidedog@gmail.com> - 2016-10-18 10:30 -0400
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-18 18:54 +0200
Re: Basic in Forth: an old gem Doug Hoffman <glidedog@gmail.com> - 2016-10-18 14:51 -0400
Re: Basic in Forth: an old gem albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) - 2016-10-19 14:32 +0200
Page 1 of 2 [1] 2 Next page →
| From | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2016-10-12 16:00 +0200 |
| Subject | Basic in Forth: an old gem |
| Message-ID | <ntlfme$sfa$1@cherry.spenarnc.xs4all.nl> |
By accident, specifying suboptimal search commands to google, in order to find a Basic written in Forth I found this http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt It is not even a page, it is a loose file, and it is not reachable from the main page of mr. Nicholson. I got lucky, other files in this directory have no read privileges.(!) It is a 10 screen basic, written by a Master with the initials "map", 1984. There are no hints about its origin and the file starts with an advertisement unrelated to its content. (!) I was interested in Lisp compilers, then I found this Lisp compiler in Pascal, called Lispkit. This got me interested in Pascal compilers, with the hope that the Pascal subset used in this Lisp compiler could be handled by a simple compiler written in ciforth which would be at the same time an exercise to get at Lisp. (No floats, no types, no records). I'm now at the point that I can tokenize the Pascal source of the Lisp compiler with a ciforth program, soon to be published, which is probably relevant to a Lisp compiler in Forth. Pascal resembles Basic somewhat, and I knew that there were Basic compilers in Forth floating around. There are some publications on ebooks in amazon, that are probably not worth the money (1980 vintage) I found a tiny modula 2 compiler written for the Novix Forth computer. Half of the source is devoted to hoisting up the Novix to the level that one can write a half decent program in it. In short a disappointment. All the Pascal compilers I've seen do not assign precedence to operators, and uses the ugly statement -> term -> factor scheme that can be handled by Backus Naur without introducing priorities. This tiny compiler uses precedence and somehow shows to me that the traditional Pascal approach is unnecessarily bloated. This is the first time I've seen the point of the ALSO / VOCABULARY design. This tiny program uses 4 vocabulary's and almost exclusively one line definitions. So there are at least two techniques to be learned from this 128 line program. (For the Lispers, there are a total of five namespaces involved. One can imagine that it is useful to handle different types of expressions in their own namespace.) Without the map initials I would have sworn that it has been written by Moore himself. (Or is it short for Moore, a programmer ? ) An example: \ [ basic: GOSUB demo ] 19Jul84map INTEGER K 9 ARRAY COORDINATE : RUN BASIC 10 FOR K = 1 TO 9 20 LET COORDINATE K = 10 - K 30 GOSUB 60 40 NEXT K 50 GOTO 80 60 PRINT COORDINATE K 70 RETURN 80 END Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [next] | [standalone]
| From | trans <transfire@gmail.com> |
|---|---|
| Date | 2016-10-12 10:19 -0700 |
| Message-ID | <35e5237f-7f5a-4b17-9f76-8b9e4f6c80bc@googlegroups.com> |
| In reply to | #51794 |
On Wednesday, October 12, 2016 at 9:51:52 AM UTC-4, Albert van der Horst wrote: > By accident, specifying suboptimal search commands to google, > in order to find a Basic written in Forth I found this > > http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt > > ... > > \ [ basic: GOSUB demo ] 19Jul84map > INTEGER K > 9 ARRAY COORDINATE > > : RUN BASIC > 10 FOR K = 1 TO 9 > 20 LET COORDINATE K = 10 - K > 30 GOSUB 60 > 40 NEXT K > 50 GOTO 80 > 60 PRINT COORDINATE K > 70 RETURN > 80 END Damn Forth is amazing.
[toc] | [prev] | [next] | [standalone]
| From | "Ed" <invalid@nospam.com> |
|---|---|
| Date | 2016-10-13 10:50 +1000 |
| Message-ID | <ntmi9q$ehr$1@gioia.aioe.org> |
| In reply to | #51802 |
trans wrote: > On Wednesday, October 12, 2016 at 9:51:52 AM UTC-4, Albert van der Horst wrote: > > By accident, specifying suboptimal search commands to google, > > in order to find a Basic written in Forth I found this > > > > http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt > > > > ... > > > > \ [ basic: GOSUB demo ] 19Jul84map > > INTEGER K > > 9 ARRAY COORDINATE > > > > : RUN BASIC > > 10 FOR K = 1 TO 9 > > 20 LET COORDINATE K = 10 - K > > 30 GOSUB 60 > > 40 NEXT K > > 50 GOTO 80 > > 60 PRINT COORDINATE K > > 70 RETURN > > 80 END > > Damn Forth is amazing. To cater to all customers, microcontroller vendor AM Research (AMR Forth) included a BASIC compiler (written in Forth). The source for entire system may still be available somewhere. Another 'BASIC in Forth' can be found in 4tH. Of course, once you know Forth who needs BASIC. The same can be said for abstraction and other attempts to 'dumb down' Forth.
[toc] | [prev] | [next] | [standalone]
| From | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2016-10-13 03:24 +0200 |
| Message-ID | <ntmnp0$ub3$1@cherry.spenarnc.xs4all.nl> |
| In reply to | #51814 |
In article <ntmi9q$ehr$1@gioia.aioe.org>, Ed <invalid@nospam.com> wrote: >trans wrote: >> On Wednesday, October 12, 2016 at 9:51:52 AM UTC-4, Albert van der Horst wrote: >> > By accident, specifying suboptimal search commands to google, >> > in order to find a Basic written in Forth I found this >> > >> > http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt >> > >> > ... >> > >> > \ [ basic: GOSUB demo ] 19Jul84map >> > INTEGER K >> > 9 ARRAY COORDINATE >> > >> > : RUN BASIC >> > 10 FOR K = 1 TO 9 >> > 20 LET COORDINATE K = 10 - K >> > 30 GOSUB 60 >> > 40 NEXT K >> > 50 GOTO 80 >> > 60 PRINT COORDINATE K >> > 70 RETURN >> > 80 END >> >> Damn Forth is amazing. > >To cater to all customers, microcontroller vendor AM Research (AMR Forth) >included a BASIC compiler (written in Forth). The source for entire system >may still be available somewhere. > >Another 'BASIC in Forth' can be found in 4tH. > >Of course, once you know Forth who needs BASIC. The same can be said >for abstraction and other attempts to 'dumb down' Forth. You may be aware that I'm only interested in those because of techniques to implement Lisp in Forth. Once you know Lisp who needs Forth ;-) I'd say that 8th and oforth are valuable attempts to 'dumb up' Forth. Groetjes Albert > > > -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | "Ed" <invalid@nospam.com> |
|---|---|
| Date | 2016-10-13 12:51 +1000 |
| Message-ID | <ntmpbn$lor$1@gioia.aioe.org> |
| In reply to | #51818 |
Albert van der Horst wrote: > In article <ntmi9q$ehr$1@gioia.aioe.org>, Ed <invalid@nospam.com> wrote: > > > >Of course, once you know Forth who needs BASIC. The same can be said > >for abstraction and other attempts to 'dumb down' Forth. > ... > I'd say that 8th and oforth are valuable attempts to 'dumb up' Forth. Historically such ventures have not survived, IMO for the reason given. I do however commend their authors for their courage in 'going it alone' and not imposing their ideas on others.
[toc] | [prev] | [next] | [standalone]
| From | Hans Bezemer <the.beez.speaks@gmail.com> |
|---|---|
| Date | 2016-10-13 17:41 +0200 |
| Message-ID | <57ffab37$0$910$e4fe514c@news.xs4all.nl> |
| In reply to | #51814 |
Ed wrote: > trans wrote: >> On Wednesday, October 12, 2016 at 9:51:52 AM UTC-4, Albert van der Horst >> wrote: >> > By accident, specifying suboptimal search commands to google, >> > in order to find a Basic written in Forth I found this >> > >> > http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt >> > >> > ... >> > >> > \ [ basic: GOSUB demo ] 19Jul84map >> > INTEGER K >> > 9 ARRAY COORDINATE >> > >> > : RUN BASIC >> > 10 FOR K = 1 TO 9 >> > 20 LET COORDINATE K = 10 - K >> > 30 GOSUB 60 >> > 40 NEXT K >> > 50 GOTO 80 >> > 60 PRINT COORDINATE K >> > 70 RETURN >> > 80 END >> >> Damn Forth is amazing. > > To cater to all customers, microcontroller vendor AM Research (AMR Forth) > included a BASIC compiler (written in Forth). The source for entire > system may still be available somewhere. > > Another 'BASIC in Forth' can be found in 4tH. And given it doesn't support strings, it's quite capable. You can program it in Classic Basic or modern Basic (or even mix the two), it has functions, procedures (with parameters) and supports local variables. https://rosettacode.org/wiki/Category:UBasic/4tH Hans Bezemer
[toc] | [prev] | [next] | [standalone]
| From | mhx@iae.nl |
|---|---|
| Date | 2016-10-12 11:37 -0700 |
| Message-ID | <742a69cb-9502-4976-935c-2c09db10bab5@googlegroups.com> |
| In reply to | #51794 |
On Wednesday, October 12, 2016 at 3:51:52 PM UTC+2, Albert van der Horst wrote: > By accident, specifying suboptimal search commands to google, > in order to find a Basic written in Forth I found this > > http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt > > It is not even a page, it is a loose file, and it is not > reachable from the main page of mr. Nicholson. > I got lucky, other files in this directory have no read privileges.(!) > > It is a 10 screen basic, written by a Master with the > initials "map", 1984. There are no hints about its origin and the > file starts with an advertisement unrelated to its content. (!) [..] > Without the map initials I would have sworn that it has been > written by Moore himself. (Or is it short for > Moore, a programmer ? ) Michael A. Perry? ( http://www.firmworks.com/www/perry.htm ) To find a very good BASIC in Forth, look behind the Vijgeblad (Lennart Benschop). For a classical approach to writing a compiler: http://home.iae.nl/users/mhx/crenshaw/tiny.html Or look at Gray. -marcel
[toc] | [prev] | [next] | [standalone]
| From | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2016-10-12 21:20 +0200 |
| Message-ID | <ntm2do$t59$1@cherry.spenarnc.xs4all.nl> |
| In reply to | #51806 |
In article <742a69cb-9502-4976-935c-2c09db10bab5@googlegroups.com>, <mhx@iae.nl> wrote: >On Wednesday, October 12, 2016 at 3:51:52 PM UTC+2, Albert van der Horst wrote: >> By accident, specifying suboptimal search commands to google, >> in order to find a Basic written in Forth I found this >> >> http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt >> >> It is not even a page, it is a loose file, and it is not >> reachable from the main page of mr. Nicholson. >> I got lucky, other files in this directory have no read privileges.(!) >> >> It is a 10 screen basic, written by a Master with the >> initials "map", 1984. There are no hints about its origin and the >> file starts with an advertisement unrelated to its content. (!) >[..] >> Without the map initials I would have sworn that it has been >> written by Moore himself. (Or is it short for >> Moore, a programmer ? ) > >Michael A. Perry? ( http://www.firmworks.com/www/perry.htm ) Yes, according to Coos Haak this is from year III of Forth dimensions nr 6. > >To find a very good BASIC in Forth, look >behind the Vijgeblad (Lennart Benschop). I looked there https://forth.hcc.nl/vijgebladarchief/index.html volume 32 Unfortunately the source is available via a modem and a bulletin board, I don't want to fire up my modem just to find out that the bulletin board is out of business. > >For a classical approach to writing a compiler: http://home.iae.nl/users/mhx/crenshaw/tiny.html That is if you want to go for the tedious job of writing a full blown Pascal compiler. For insights I will first study the Tiny Basic of Mike Perry. > >Or look at Gray. One day I will. > >-marcel Groetjes Albert > -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | Mark Wills <markwills1970@gmail.com> |
|---|---|
| Date | 2016-10-13 05:01 -0700 |
| Message-ID | <a9b1af3d-eabc-450a-a9cf-dccb9c755c0d@googlegroups.com> |
| In reply to | #51794 |
On Wednesday, 12 October 2016 14:51:52 UTC+1, Albert van der Horst wrote: > By accident, specifying suboptimal search commands to google, > in order to find a Basic written in Forth I found this > > http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt > > It is not even a page, it is a loose file, and it is not > reachable from the main page of mr. Nicholson. > I got lucky, other files in this directory have no read privileges.(!) > > It is a 10 screen basic, written by a Master with the > initials "map", 1984. There are no hints about its origin and the > file starts with an advertisement unrelated to its content. (!) > > I was interested in Lisp compilers, then I found this Lisp > compiler in Pascal, called Lispkit. This got me interested in Pascal > compilers, with the hope that the Pascal subset used in this Lisp compiler > could be handled by a simple compiler written in ciforth which would > be at the same time an exercise to get at Lisp. (No floats, no types, > no records). > > I'm now at the point that I can tokenize the Pascal source of the Lisp > compiler with a ciforth program, soon to be published, which is > probably relevant to a Lisp compiler in Forth. > > Pascal resembles Basic somewhat, and I knew that there were Basic > compilers in Forth floating around. There are some publications on ebooks > in amazon, that are probably not worth the money (1980 vintage) > I found a tiny modula 2 compiler written for the Novix Forth > computer. Half of the source is devoted to hoisting up the Novix > to the level that one can write a half decent program in it. > In short a disappointment. > > All the Pascal compilers I've seen do not assign precedence to > operators, and uses the ugly statement -> term -> factor scheme that > can be handled by Backus Naur without introducing priorities. > This tiny compiler uses precedence and somehow shows to me > that the traditional Pascal approach is unnecessarily bloated. > This is the first time I've seen the point of the > ALSO / VOCABULARY design. This tiny program uses 4 vocabulary's > and almost exclusively one line definitions. > So there are at least two techniques to be learned from this > 128 line program. > (For the Lispers, there are a total of five namespaces involved. > One can imagine that it is useful to handle different types of > expressions in their own namespace.) > > Without the map initials I would have sworn that it has been > written by Moore himself. (Or is it short for > Moore, a programmer ? ) > > An example: > > > \ [ basic: GOSUB demo ] 19Jul84map > INTEGER K > 9 ARRAY COORDINATE > > : RUN BASIC > 10 FOR K = 1 TO 9 > 20 LET COORDINATE K = 10 - K > 30 GOSUB 60 > 40 NEXT K > 50 GOTO 80 > 60 PRINT COORDINATE K > 70 RETURN > 80 END > > Groetjes Albert > -- > Albert van der Horst, UTRECHT,THE NETHERLANDS > Economic growth -- being exponential -- ultimately falters. > albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst It's from the article "Charles Moore's Basic Compiler Revisited" by Michael Perry, Forth Dimensions, Volume 3, Issue 6, page 175. As the title indicates, it was originally written by Chuck. Marvellous. If you want the PDF of the particular Forth Dimensions issue just let me know. Regards Mark
[toc] | [prev] | [next] | [standalone]
| From | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2016-10-13 14:27 +0200 |
| Message-ID | <ntnuj2$td$1@cherry.spenarnc.xs4all.nl> |
| In reply to | #51827 |
In article <a9b1af3d-eabc-450a-a9cf-dccb9c755c0d@googlegroups.com>, Mark Wills <markwills1970@gmail.com> wrote: >On Wednesday, 12 October 2016 14:51:52 UTC+1, Albert van der Horst wrote: >> By accident, specifying suboptimal search commands to google, >> in order to find a Basic written in Forth I found this >> >> http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt >> >> It is not even a page, it is a loose file, and it is not >> reachable from the main page of mr. Nicholson. >> I got lucky, other files in this directory have no read privileges.(!) >> >> It is a 10 screen basic, written by a Master with the >> initials "map", 1984. There are no hints about its origin and the >> file starts with an advertisement unrelated to its content. (!) <SNIP> > >It's from the article "Charles Moore's Basic Compiler Revisited" >by Michael Perry, Forth Dimensions, Volume 3, Issue 6, page 175. > >As the title indicates, it was originally written by Chuck. > >Marvellous. If you want the PDF of the particular Forth Dimensions >issue just let me know. Thanks for the offer. I've it in print, like my comrade Coos Haak who can actually find it. I'm desperately trying to get my 20 cubic metre of stuff sorted out. > >Regards > >Mark Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | Coos Haak <htrofhc@gmail.com> |
|---|---|
| Date | 2016-10-13 16:27 +0200 |
| Message-ID | <1c9apo9svm2fb$.399y39krmzkq$.dlg@40tude.net> |
| In reply to | #51827 |
Op Thu, 13 Oct 2016 05:01:56 -0700 (PDT) schreef Mark Wills: <snip> > It's from the article "Charles Moore's Basic Compiler Revisited" > by Michael Perry, Forth Dimensions, Volume 3, Issue 6, page 175. > > As the title indicates, it was originally written by Chuck. > > Marvellous. If you want the PDF of the particular Forth Dimensions > issue just let me know. > > Regards > > Mark For years now, one could (and still can) find the PDF's of Forth Dimensions at http://www.forth.org/fd/contents.html and http://www.forth.org/fd/FDcover.html has indexes. So no need to keep the paper copies. Just joking. groet Coos
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2016-10-13 14:08 -0700 |
| Message-ID | <987abf77-dd87-43df-ada5-b052ed3643d6@googlegroups.com> |
| In reply to | #51827 |
On Thursday, October 13, 2016 at 5:01:57 AM UTC-7, Mark Wills wrote: > It's from the article "Charles Moore's Basic Compiler Revisited" > by Michael Perry, Forth Dimensions, Volume 3, Issue 6, page 175. > > As the title indicates, it was originally written by Chuck. > > Marvellous. If you want the PDF of the particular Forth Dimensions > issue just let me know. > > Regards > > Mark Ching took Charles Moore's BASIC compiler idea and ran with it. He now has ABC that is a significant improvement on the original --- Ching has a lot of numeric functions written and he uses ABC for all of his work (he is a mathematician and physicist) --- he seems to think of Forth as being a low-level language, but ABC as being useful for everyday programming (similar to how C is used for low-level code and Python for high-level code). None of this is ANS-Forth --- if I recall correctly, Ching has his ABC working under VFX --- ABC is in the same category as my rquotations; easy to implement in most or all ANS-Forth systems, but requiring unlawful carnal knowledge.
[toc] | [prev] | [next] | [standalone]
| From | Lars Brinkhoff <lars.spam@nocrew.org> |
|---|---|
| Date | 2016-10-14 07:26 +0200 |
| Message-ID | <8637jz4i1v.fsf@molnjunk.nocrew.org> |
| In reply to | #51841 |
> Ching took Charles Moore's BASIC compiler idea and ran with it. He now > has ABC that is a significant improvement on the original It's this, right? http://forthfortnight.blogspot.com/
[toc] | [prev] | [next] | [standalone]
| From | hughaguilar96@gmail.com |
|---|---|
| Date | 2016-10-14 01:07 -0700 |
| Message-ID | <3313e531-4243-4954-b896-5fd0cdc244ea@googlegroups.com> |
| In reply to | #51855 |
On Thursday, October 13, 2016 at 10:26:54 PM UTC-7, Lars Brinkhoff wrote: > > Ching took Charles Moore's BASIC compiler idea and ran with it. He now > > has ABC that is a significant improvement on the original > > It's this, right? > > http://forthfortnight.blogspot.com/ Yes, that is it. Note that I haven't actually used ABC myself --- I'm not much interested in BASIC and I don't know much about math --- Ching just told me about it, and I looked into how the mechanism works and whether this could be done in ANS-Forth or not (it can't).
[toc] | [prev] | [next] | [standalone]
| From | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2016-10-14 00:48 +0200 |
| Message-ID | <ntp30f$373$1@cherry.spenarnc.xs4all.nl> |
| In reply to | #51827 |
In article <a9b1af3d-eabc-450a-a9cf-dccb9c755c0d@googlegroups.com>, Mark Wills <markwills1970@gmail.com> wrote: >On Wednesday, 12 October 2016 14:51:52 UTC+1, Albert van der Horst wrote: >> By accident, specifying suboptimal search commands to google, >> in order to find a Basic written in Forth I found this >> >> http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt >> <SNIP> >> Groetjes Albert > >It's from the article "Charles Moore's Basic Compiler Revisited" >by Michael Perry, Forth Dimensions, Volume 3, Issue 6, page 175. Apparently it is older. That articles code is fig-Forth. The nicholson file doesn't contain yet <BUILDS but CONSTANT or VARIABLE instead. The article is more useful if only for the explanation. > >As the title indicates, it was originally written by Chuck. > >Marvellous. If you want the PDF of the particular Forth Dimensions >issue just let me know. > >Regards > >Mark -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2016-10-16 11:49 +0200 |
| Message-ID | <ntvifl$mef$1@cherry.spenarnc.xs4all.nl> |
| In reply to | #51794 |
Forth words in text are preceded in text by ` (back quote)
In article <ntlfme$sfa$1@cherry.spenarnc.xs4all.nl>,
Albert van der Horst <albert@cherry.spenarnc.xs4all.nl> wrote:
>By accident, specifying suboptimal search commands to google,
>in order to find a Basic written in Forth I found this
>
>http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt
>
>It is not even a page, it is a loose file, and it is not
>reachable from the main page of mr. Nicholson.
>I got lucky, other files in this directory have no read privileges.(!)
>
>It is a 10 screen basic, written by a Master with the
>initials "map", 1984. There are no hints about its origin and the
>file starts with an advertisement unrelated to its content. (!)
For those who want to actually run this, here is what I did
for lina64.
I've made a preamble to run the tiny basic as published by Nicholson.
His screens are not the same than those in Forth Dimensions III-6.
An important advantage is that not the addresses but the line numbers
are negated to indicate that a line-address is resolved. So now basic
programs that are compiled above $8000,0000,0000,0000 run okay. Then
there are other differences because of the Forth used.
A preamble is better then editing the source of a working program.
After all tests pass you can add more regression tests, and then
start changing the program,
There is one exception. The test word `.R is hard to make working and
is not used in the Tiny Basic, so I commented it out.
These are the additions needed for lina64 or lina32.
---------------------------
WANT >= VOCABULARY ALIAS WORD +THRU TRUE
: 2+ CELL+ ; : 2- 1 CELLS - ; : 2* CELLS ;
: 4 2 CELLS ; : -4 -2 CELLS ;
'[CHAR] ALIAS ASCII
'PP ALIAS >IN \ ciforth only
'POSTPONE ALIAS COMPILE 'POSTPONE ALIAS [COMPILE]
: LENGTH $@ ; \ @+
: QUERY (ACCEPT) SET-SRC ;
: NUMBER >R 0. R> COUNT >NUMBER 2DROP ;
: CONSTANT CREATE , ;
: VARIABLE CREATE 1 CELLS ALLOT ;
: OFF 0 SWAP ! ; : ON 1 SWAP ! ;
: (.) 0 <# #S #> ;
--------------------------
After `WANT is a list of (more or less) standard words that will
already be present in a Forth like gforth. A caveat. The `VOCABULARY
is an old-fashioned replacing one, not a pushing one, if so then add a
`PREVIOUS .
: VOCABULARY PREVIOUS VOCABULARY ;
In order to have `+THRU work, the tiny basic must be transformed
to a block file. First delete everything before where it says
\ BASIC compiler
The text before that block has weird line endings.
Then insert 16 lines for block zero (traditionally there must be
no code in block zero).
Now convert it to a block file in your usual way. In ciforth
we use a Forth program toblk :
toblk tinybasic.txt tinybasic.blk
I want an executable mforth that has the tinybasic.blk
as its mass storage. In ciforth this is accomplished by
-------- addition.frt ------
WANT SAVE-SYSTEM
"tinybasic.blk" BLOCK-FILE $! 0 WARNING !
"mforth" SAVE-SYSTEM
-------------------------
cat addition.frt | lina64 -a
(Or just past the above into the interpreter)
The `WARNING must be off, because this block file doesn't contain
textual error messages.
Now start mforth and type "1 LOAD" (or type "mforth -a").
The test examples are run by loading their respective screens:
12 LOAD
You may want to add
WANT RESTORED
It it nice to do
'OK RESTORED
because SAVE-SYSTEM suppresses OK output.
To aid in debugging labels, I added a test:
0 \ [ basic: GOTO demo ]
1 INTEGER K
2
3
4 : RUN BASIC
5 10 PRINT " line 10"
6 20 GOTO 40
7 30 PRINT " wrong! line 30 must be suppressed"
8 40 REM nothing
9 50 PRINT " line 50"
10 80 END
11
12
13 RUN
14
15 \ Need a last line
Have fun!
Groetjes Albert
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2016-10-16 21:16 +0200 |
| Message-ID | <nu0jna$qbn$1@cherry.spenarnc.xs4all.nl> |
| In reply to | #51888 |
In article <ntvifl$mef$1@cherry.spenarnc.xs4all.nl>, Albert van der Horst <albert@cherry.spenarnc.xs4all.nl> wrote: >Forth words in text are preceded in text by ` (back quote) > >In article <ntlfme$sfa$1@cherry.spenarnc.xs4all.nl>, >Albert van der Horst <albert@cherry.spenarnc.xs4all.nl> wrote: >>By accident, specifying suboptimal search commands to google, >>in order to find a Basic written in Forth I found this >> >>http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt >> >>It is not even a page, it is a loose file, and it is not >>reachable from the main page of mr. Nicholson. >>I got lucky, other files in this directory have no read privileges.(!) >> >>It is a 10 screen basic, written by a Master with the >>initials "map", 1984. There are no hints about its origin and the >>file starts with an advertisement unrelated to its content. (!) > >For those who want to actually run this, here is what I did >for lina64. > >I've made a preamble to run the tiny basic as published by Nicholson. > >His screens are not the same than those in Forth Dimensions III-6. >An important advantage is that not the addresses but the line numbers >are negated to indicate that a line-address is resolved. So now basic >programs that are compiled above $8000,0000,0000,0000 run okay. Then >there are other differences because of the Forth used. > >A preamble is better then editing the source of a working program. But one can get overboard with this. >After all tests pass you can add more regression tests, and then >start changing the program, >There is one exception. The test word `.R is hard to make working and >is not used in the Tiny Basic, so I commented it out. There is an other exception, see below. > >These are the additions needed for lina64 or lina32. >--------------------------- >WANT >= VOCABULARY ALIAS WORD +THRU TRUE > >: 2+ CELL+ ; : 2- 1 CELLS - ; : 2* CELLS ; >: 4 2 CELLS ; : -4 -2 CELLS ; Delete that line. I knew I couldn't get away with that. This results in * having priority 16, higher than ** (which has 5) and screen 14 fails. Just replace 4 by "2 CELLS" but not for the priority of multiplication. > >Have fun! > >Groetjes Albert > Groetjes Albert -- Albert van der Horst, UTRECHT,THE NETHERLANDS Economic growth -- being exponential -- ultimately falters. albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
| From | jim <anon@example.com> |
|---|---|
| Date | 2016-10-17 00:37 +0100 |
| Message-ID | <MPG.326e1f99bc840d07989697@news.virginmedia.com> |
| In reply to | #51901 |
In article <nu0jna$qbn$1@cherry.spenarnc.xs4all.nl>, albert@cherry.spenarnc.xs4all.nl says... > > My understanding is tesla was experimenting with the natural capacitance of the earth (ie the potential difference between a high tower and the ground) It had nothing to do with "wireless" power.
[toc] | [prev] | [next] | [standalone]
| From | foxaudioresearch@gmail.com |
|---|---|
| Date | 2016-10-18 12:02 -0700 |
| Message-ID | <2c1babcc-1f1a-4043-82db-6b30d03c02c5@googlegroups.com> |
| In reply to | #51913 |
On Sunday, October 16, 2016 at 7:39:01 PM UTC-4, jim wrote: > In article <nu0jna$qbn$1@cherry.spenarnc.xs4all.nl>, > albert@cherry.spenarnc.xs4all.nl says... > > > > > My understanding is tesla was experimenting with the natural capacitance > of the earth (ie the potential difference between a high tower and the ground) > It had nothing to do with "wireless" power. I watched a program on Telsa where it was implied that he was given a contract to create wireless communication but his passion was to create wireless power distribution. At one of the demonstrations it became clear to the investors that they had been duped and he was dropped. One the questions that came up that Tesla had not thought of was "How will we bill for this power?" :-) Oops. Nevertheless he had a great mind and made modern power distribution possible and gave use 3 phase power as well. BF
[toc] | [prev] | [next] | [standalone]
| From | albert@cherry.spenarnc.xs4all.nl (Albert van der Horst) |
|---|---|
| Date | 2016-10-18 15:51 +0200 |
| Message-ID | <nu59d9$es4$1@cherry.spenarnc.xs4all.nl> |
| In reply to | #51888 |
Forth words in text are preceded in text by ` (back quote)
In article <ntvifl$mef$1@cherry.spenarnc.xs4all.nl>,
Albert van der Horst <albert@cherry.spenarnc.xs4all.nl> wrote:
>
>In article <ntlfme$sfa$1@cherry.spenarnc.xs4all.nl>,
>Albert van der Horst <albert@cherry.spenarnc.xs4all.nl> wrote:
>>By accident, specifying suboptimal search commands to google,
>>in order to find a Basic written in Forth I found this
>>
>>http://www.nicholson.com/rhn/files/Tiny_BASIC_in_Forth.txt
>>
>>It is not even a page, it is a loose file, and it is not
>>reachable from the main page of mr. Nicholson.
>>I got lucky, other files in this directory have no read privileges.(!)
>>
>>It is a 10 screen basic, written by a Master with the
>>initials "map", 1984. There are no hints about its origin and the
>>file starts with an advertisement unrelated to its content. (!)
>
>For those who want to actually run this, here is what I did
>for lina64.
>
>I've made a preamble to run the tiny basic as published by Nicholson.
>
The following is more of a step by step instruction.
Management summary:
Once tiny basic can be interpreted using a preamble,
integrating tiny basic in ciforth is surprisingly easy.
This results in an interpreting BASIC, scripting BASIC and
BASIC executables. The WANT mechanism is instrumental
to this.
Background:
A block file consist of blocks which are numbered 0 ..
A block has 16 lines, the first line is called index line.
Each block can be included separately by a command like
"### LOAD" where ### is the blocks number. A block is also
called screen if it contains text.
First of all a recapitulation of how the WANT mechanism
in ciforth works.
ciforth has access to a lab file: a block file with stylized
index lines. "WANT BASIC" will search for an index line which contains
BASIC, skipping some system devoted blocks. A block found will
be loaded, and it is checked whether now the word `BASIC is present.
If it is not, the search will continue. So in order to have a facility
Q available which needs 2 screens, it is sufficient to define
Q in he second screen and have Q in both index lines.
Assuming we have available the words that are needed by our tiny basic,
it so happens that it is sufficient to insert the tinybasic.blk
into the lab file.
Tinybasic.blk has a "load screen" . For those who are not familiar
with blocks: a load screen for a facility is a single screen that
can be loaded in order to have that facility. This screen
contains other `LOAD commands or hopefully the screen-relative
`+THRU commands. tiny-basic uses this mechanism, such that
if the load screen is at 123 the command "123 LOAD" will pull
in all of tiny basic.
Not surprisingly the load screen contains the word BASIC in
its index line. So "WANT BASIC" will load it and we don't ever
bother with its screen number 123.
Not too surprisingly after loading this screen, the word `BASIC is
available, and the wanting is over.
So this early twentieth century BASIC complies with the conventions
I require for my `WANT. (!)
We still need the preamble, that easily fits in one screen.
Like with the `Q example, it is sufficient to put BASIC in
its index line and place it in front of the tiny BASIC blocks
in the lab file.
Now "WANT BASIC" works from a bald lina.
These are the step by step instructions:
1. Set up a directory and get a local copy of lina by 0]
lina64 -i mylina forth.lab
2. Get the tinybasic file and isolate the tinybasic in
tinybasic.frt. Make sure it is a multiple of 16 lines and that
the last line is not empty. (Just put a comment)
The basic examples can be put in separate files ex1.bas ex2.bas.
3 Replace "4" in tinybasic.frt by "2 CELLS" except for the line
4 PRECEDENCE * 4 PRECEDENCE / 4 PRECEDENCE */
4. Put the following preamble in a file preamble.frt
-------------------------------------------
\ BASIC preamble for the Moore/Perry tiny basic compiler.
WANT >= VOCABULARY ALIAS WORD SAVE-SYSTEM +THRU TRUE RESTORED
: EXECUTE-PARSING ROT ROT SAVE SET-SRC CATCH RESTORE THROW ;
: 2+ CELL+ ; : 2- 1 CELLS - ; : 2* CELLS ;
'[CHAR] ALIAS ASCII
'PP ALIAS >IN
'POSTPONE ALIAS COMPILE 'POSTPONE ALIAS [COMPILE]
'$@ ALIAS LENGTH
: QUERY (ACCEPT) SET-SRC ;
: NUMBER COUNT '(NUMBER) EXECUTE-PARSING ;
: CONSTANT CREATE , ;
: VARIABLE CREATE 1 CELLS ALLOT ;
: OFF 0 SWAP ! ; : ON 1 SWAP ! ;
: (.) 0 <# #S #> ;
: SRC>EXEC 4 - 2DUP + ".bas" CORA IF 2DROP "a.out" THEN ;
\ that's all folks
-------------------------------------------
5. Concatenate, this is the hard part.
Edit forth.lab and go to the last line. Then go up by 16 lines.
At this place add preamble.frt and tinybasic.frt in that order.
In this way the last screen stays intact, it is an end
sentinel.
Now make it into a lab file, a file with lines of
exactly 64 char's, the last one a ^J.
This is easiest with an auxiliary program, especially because
some lines are too long and have to be edited. 1]
Like so:
toblk forth.lab forth2.lab
My toblk is capable of shoe-horning. If a line doesn't fit,
two blanks are replaced by one. Probably you're a master of
emacs and have some other means to get it right.
You can inspect your result with
"
lina64 -l forth2.lab
1 1000 INDEX
"
The correct index lines of the tinybasic must show up.
When you're happy move forth2.lab over the file forth.lab
and use ./mylina henceforth.
This puts you in a position to run one of the examples.
mylina -a
WANT BASIC
INCLUDE ex1.bas
By adding to ex1.bas a starting line
WANT BASIC
and leaving out the line with RUN at the end,
ex1.bas has become a real basic program to be used like
INCLUDE ex1.bas
RUN
Can we also compile basic programs? Yes we can!
It is the same than compiling Forth programs. After all it *is*
a Forth program.
mylina -c ex1.bas
Indeed this gives an executable ex1 that works. 3]
"ex1" is an elf executable that you can ship to someone with any Intel
Linux, even on that has not been upgraded since 1999, and it
will work, without a libc, lina installation or whatever. 2]
Before you get too enthusiastic, this Basic has a flaw.
The labels table #S only allows a maximum of 7 lines for your
basic program (on a 64 bit Forth). You may want to increase the
ALLOTted space.
Then there is scripting. I'll sketch it briefly because it starts boring.
With WANT BASIC and
"mbasic" SAVE-SYSTEM
you can have scripts that start with
#!./mbasic -s
...
This save you a large amount of REDEFINED messages when loading the
basic.
0]
lina is available from the site in my sig.
1]
You can download this from the site below, file forthtools.html.
2]
Provided you use lina32 not lina64.
3]
Compiled ciforth programs execute the last word defined.
In tiny basic that is the word `RUN , which is okay.
Note that the preamble contains SRC>EXEC . Otherwise you'd
get a file a.out.
Groetjes Albert
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.forth
csiph-web