Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #42341 > unrolled thread
| Started by | Chris Curl <ccurl609@gmail.com> |
|---|---|
| First post | 2015-10-03 13:47 -0700 |
| Last post | 2015-10-07 14:05 -0700 |
| Articles | 10 — 7 participants |
Back to article view | Back to comp.lang.forth
Sorta interesting ... to me at least ... :) Chris Curl <ccurl609@gmail.com> - 2015-10-03 13:47 -0700
Re: Sorta interesting ... to me at least ... :) Paul Rubin <no.email@nospam.invalid> - 2015-10-03 15:04 -0700
Re: Sorta interesting ... to me at least ... :) dylan.mcnamee@gmail.com - 2015-10-03 16:19 -0700
Re: Sorta interesting ... to me at least ... :) Andreas Wagner <andreas.wagner@lowfatcomputing.org> - 2015-10-03 16:53 -0700
Re: Sorta interesting ... to me at least ... :) Paul Rubin <no.email@nospam.invalid> - 2015-10-04 14:02 -0700
Re: Sorta interesting ... to me at least ... :) "Elizabeth D. Rather" <erather@forth.com> - 2015-10-03 16:19 -1000
Re: Sorta interesting ... to me at least ... :) Chris Curl <ccurl609@gmail.com> - 2015-10-04 17:43 -0700
Re: Sorta interesting ... to me at least ... :) "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-10-07 02:54 -0400
Re: Sorta interesting ... to me at least ... :) Lars Brinkhoff <lars.spam@nocrew.org> - 2015-10-07 10:43 +0200
Re: Sorta interesting ... to me at least ... :) Chris Curl <ccurl609@gmail.com> - 2015-10-07 14:05 -0700
| From | Chris Curl <ccurl609@gmail.com> |
|---|---|
| Date | 2015-10-03 13:47 -0700 |
| Subject | Sorta interesting ... to me at least ... :) |
| Message-ID | <1f50230f-bc7c-4a69-b054-756c8be44e1f@googlegroups.com> |
So I wrote this little C++ program to emulate my idea of what I would like a Forth VM to be able to do. That initializes itself with about 20 words as the basis of my dictionary. I then used that to read and interpret a bootstrap file using the 20 base words that filled in the rest of my dictionary. I'm sure this is probably a pretty standard way of implementing a Forth system. Yawn ... The fun part of it is that I have now written a set of words to disassemble the system in terms of my VM's machine language, and another set of words that does a dis-assembly as well, except that this other word set spits out x86 assembly code that does the same thing. I can compile that directly using MASM32 without having to make any changes It is not complete yet, but when it is, I'll be stoked.
[toc] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2015-10-03 15:04 -0700 |
| Message-ID | <87twq78v7a.fsf@jester.gateway.sonic.net> |
| In reply to | #42341 |
Chris Curl <ccurl609@gmail.com> writes: > I'm sure this is probably a pretty standard way of implementing a > Forth system. Yawn ... Take a look at Pygmy Forth, or if you can get past the paywall, this paper: http://dl.acm.org/citation.cfm?id=382125.382916
[toc] | [prev] | [next] | [standalone]
| From | dylan.mcnamee@gmail.com |
|---|---|
| Date | 2015-10-03 16:19 -0700 |
| Message-ID | <0b5761e7-2be7-4447-a047-e4eda579e49a@googlegroups.com> |
| In reply to | #42344 |
On Saturday, October 3, 2015 at 3:04:59 PM UTC-7, Paul Rubin wrote: > Chris Curl <ccurl...@gmail.com> writes: > > I'm sure this is probably a pretty standard way of implementing a > > Forth system. Yawn ... > > Take a look at Pygmy Forth, or if you can get past the paywall, this > paper: > > > http://dl.acm.org/citation.cfm?id=382125.382916 I belong to ACM, got past the paywall, but don't see how I can download any other SigForth newsletters. The PostScript issue looks particularly interesting to me. Paul Frenger wrote in EuroForth 1989 that the ACM gave permission to host them, and that he'd add them to the Forth WebRing, but I don't see any evidence of that (http://www.complang.tuwien.ac.at/anton/euroforth/ef06/frenger06.pdf) A pointer would be welcome. thanks, dylan
[toc] | [prev] | [next] | [standalone]
| From | Andreas Wagner <andreas.wagner@lowfatcomputing.org> |
|---|---|
| Date | 2015-10-03 16:53 -0700 |
| Message-ID | <2f9b3444-d626-4ddc-ad55-f9ec057e55d5@googlegroups.com> |
| In reply to | #42344 |
> Take a look at Pygmy Forth, or if you can get past the paywall, this > paper: > > > http://dl.acm.org/citation.cfm?id=382125.382916 Look here: http://www.pdf-archive.com/2015/01/10/cmforth/cmforth.pdf Also, "Metacompilation Made Easy" https://archive.org/stream/Forth_Dimension_Volume_12_Number_6#page/n29/mode/2up and cmForth with the shadow blocks: http://www.neverslow.com/forth/wiki.php/Forth/CMForthRtx2000
[toc] | [prev] | [next] | [standalone]
| From | Paul Rubin <no.email@nospam.invalid> |
|---|---|
| Date | 2015-10-04 14:02 -0700 |
| Message-ID | <87k2r28hz8.fsf@jester.gateway.sonic.net> |
| In reply to | #42346 |
Andreas Wagner <andreas.wagner@lowfatcomputing.org> writes: >> http://dl.acm.org/citation.cfm?id=382125.382916 > Look here: > http://www.pdf-archive.com/2015/01/10/cmforth/cmforth.pdf Thanks! I didn't know about that open copy. > Also, "Metacompilation Made Easy" > https://archive.org/stream/Forth_Dimension_Volume_12_Number_6#page/n29/mode/2up > and cmForth with the shadow blocks: > http://www.neverslow.com/forth/wiki.php/Forth/CMForthRtx2000 Those are good too--I came across both of them recently. The first one is about Pygmy Forth which I've been wanting to examine. The second is very interesting, I'd looked at cmForth before and found it incomprehensible, but the shadow blocks help explain a lot of things. Jeff Fox linked to an old post by Mark De Groot about cmForth metacompilation: http://www.ultratechnology.com/mmeta.html That was one of the things that got me interested in this. Jeff's initial page about metacompilation is here: http://www.ultratechnology.com/meta.html
[toc] | [prev] | [next] | [standalone]
| From | "Elizabeth D. Rather" <erather@forth.com> |
|---|---|
| Date | 2015-10-03 16:19 -1000 |
| Message-ID | <neWdnakk-tYhEY3LnZ2dnUU7-a-dnZ2d@supernews.com> |
| In reply to | #42341 |
On 10/3/15 10:47 AM, Chris Curl wrote: > So I wrote this little C++ program to emulate my idea of what I would like a Forth VM to be able to do. That initializes itself with about 20 words as the basis of my dictionary. I then used that to read and interpret a bootstrap file using the 20 base words that filled in the rest of my dictionary. > > I'm sure this is probably a pretty standard way of implementing a Forth system. Yawn ... Chuck Moore wrote his first Forth in the early 1970's in Fortran. Thereafter, any Forth he's worked on has been written in Forth, using what we call a "metacompiler" to compile a Forth kernel for a different platform or CPU. These Forths also include an assembler for the host CPU, also written in Forth. FORTH, Inc. has always followed this practice; we have never supported a Forth that wasn't written in Forth (including its Forth assembler). To target a Forth for a new CPU, we first write an assembler for the new target plus a few primitive definitions, and quite quickly the rest (which is in high-level Forth) is running. > The fun part of it is that I have now written a set of words to disassemble the system in terms of my VM's machine language, and another set of words that does a dis-assembly as well, except that this other word set spits out x86 assembly code that does the same thing. I can compile that directly using MASM32 without having to make any changes > > It is not complete yet, but when it is, I'll be stoked. Glad you're having fun! Cheers, Elizabeth -- ================================================== Elizabeth D. Rather (US & Canada) 800-55-FORTH FORTH Inc. +1 310.999.6784 5959 West Century Blvd. Suite 700 Los Angeles, CA 90045 http://www.forth.com "Forth-based products and Services for real-time applications since 1973." ==================================================
[toc] | [prev] | [next] | [standalone]
| From | Chris Curl <ccurl609@gmail.com> |
|---|---|
| Date | 2015-10-04 17:43 -0700 |
| Message-ID | <a30b8403-ac8b-4ee5-aa11-752f55ff3572@googlegroups.com> |
| In reply to | #42341 |
Thanks folks. I was sure this wasn't a new idea ... :)
[toc] | [prev] | [next] | [standalone]
| From | "Rod Pemberton" <boo@fasdfrewar.cdm> |
|---|---|
| Date | 2015-10-07 02:54 -0400 |
| Message-ID | <op.x54issniyfako5@localhost> |
| In reply to | #42341 |
On Sat, 03 Oct 2015 16:47:58 -0400, Chris Curl <ccurl609@gmail.com> wrote: > So I wrote this little C++ program to emulate my idea of what I would like > a Forth VM to be able to do. That initializes itself with about 20 words > as the basis of my dictionary. I then used that to read and interpret a > bootstrap file using the 20 base words that filled in the rest of my > dictionary. > > I'm sure this is probably a pretty standard way of implementing a Forth > system. Yawn ... I and others haved coded Forth partly or completely in other languages, such as C. Most C/C++ implementations use a switch() statement to select code for the low-level words or "primitives". I follow the way an interpreted fig-Forth Forth works in assembly. Lars Brinkhoff has lbForth which works more like an interpreted Forth too. The author of it replied to you in another thread. I would've thought he'd be interested. > The fun part of it is that I have now written a set of words to disassemble > the system in terms of my VM's machine language, and another set of words > that does a dis-assembly as well, except that this other word set spits > out x86 assembly code that does the same thing. I can compile that directly > using MASM32 without having to make any changes > > It is not complete yet, but when it is, I'll be stoked. That's convenient. Some would prefer NASM though. IIRC, the old FPC and TCOM Forths by Tom Zimmer for MS-DOS produced binaries. Modern Forths do as well. Rod Pemberton -- Just how many texting and calendar apps does humanity need? Just how many food articles from neurotic millenials do we need?
[toc] | [prev] | [next] | [standalone]
| From | Lars Brinkhoff <lars.spam@nocrew.org> |
|---|---|
| Date | 2015-10-07 10:43 +0200 |
| Message-ID | <867fmzjcg4.fsf@vps34351.public.cloudvps.com> |
| In reply to | #42416 |
Rod Pemberton wrote: > Chris Curl wrote: >> So I wrote this little C++ program to emulate my idea of what I would >> like a Forth VM to be able to do. That initializes itself with about >> 20 words as the basis of my dictionary. I then used that to read and >> interpret a bootstrap file using the 20 base words that filled in the >> rest of my dictionary. > > Lars Brinkhoff has lbForth which works more like an interpreted Forth > too. The author of it replied to you in another thread. Mine is a conventional ITC Forth. However, it's metacompiled. That is, there is a compiler, written in Forth, which takes a set of input files, also written in Forth, and generates an executable system. This is also rather conventional, but more rarely found in toy Forths.
[toc] | [prev] | [next] | [standalone]
| From | Chris Curl <ccurl609@gmail.com> |
|---|---|
| Date | 2015-10-07 14:05 -0700 |
| Message-ID | <75ec1414-f02b-428b-a840-e8c762562ddc@googlegroups.com> |
| In reply to | #42416 |
On Wednesday, October 7, 2015 at 2:54:11 AM UTC-4, Rod Pemberton wrote: > I and others haved coded Forth partly or completely in other > languages, such as C. Most C/C++ implementations use a switch() > statement to select code for the low-level words or "primitives". > I follow the way an interpreted fig-Forth Forth works in assembly. Mine started with a big switch () statement as well, but it ended up with 43 cases, which made it a pain to navigate, so I created an array of method pointers instead. Now, it executes the "primitive" indirectly. I don't know which implementation is more efficient, but for my purposes, it doesn't matter. It performs well enough for what I'm doing, and it is probably more like it would be implemented in an assembly language.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.forth
csiph-web