Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Paul Rubin Newsgroups: comp.lang.forth Subject: Re: C to Forth (was Ting) Date: Mon, 23 May 2016 18:53:16 -0700 Organization: A noiseless patient Spider Lines: 27 Message-ID: <87r3csgr1v.fsf@jester.gateway.pace.com> References: <5736338d.13710740@news.eternal-september.org> <42875847-66b1-49e6-b1fd-1ffcbe26c930@googlegroups.com> <87wpmuonmz.fsf@jester.gateway.pace.com> <2016May16.153714@mips.complang.tuwien.ac.at> <9cee1949-05d9-4f78-82c5-b9d9f512f2fa@googlegroups.com> <30f7a26d-ee8a-4bb1-a9e6-2fb9c5deec03@googlegroups.com> <938662b0-97b1-42dd-951c-df1fdafab845@googlegroups.com> <4ccd7da9-ce35-434d-afd5-f16c1324ede9@googlegroups.com> <0c344658-0e5b-403c-85b3-28a4d40a58aa@googlegroups.com> <87shxdeoz7.fsf@jester.gateway.pace.com> <87bn40c7oo.fsf@jester.gateway.pace.com> <87zirhgxh6.fsf@jester.gateway.pace.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx02.eternal-september.org; posting-host="c5ef8e90944559a2c1f3d45645d0f786"; logging-data="28613"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX196UwYSAQa0tcaoMBA0vBV5" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:tnjbeIei4LppEEfdfK5BkEE3ZYo= sha1:KmtuvvxuBirHLXl+MMaIqgMNUO4= Xref: csiph.com comp.lang.forth:47454 Gerry Jackson writes: > The harder case is where the target is different > (e.g. any of a different CPU, type of threading, dictionary structure > etc) when target code can't be executed. Here wordlists are very > helpful if not essential, as is another outer interpreter. I'll have to think about this more. The approach I've been envisioning was to have a portable (all ANS) compiler that produces bytecode for a simple VM. The VM could be implemented (say in assembler) on any reasonable target and run the bytecode. The compiler would of course itself be able to compile itself into bytecode, making the jump from host to target that way. Then the bytecode backend could be replaced with a native STC generator for the relevant platform. > I don't think the wordlist contributed to any ugliness, that is due to > the fact that ANS Forth has no direct way of defining a word without > parsing a name. I'd consider that absence to be a deficiency of ANS wordlists. ANS has FIND (looks up a string given in c-addr form) but no way to do the opposite (create a dictionary from a string, maybe it could be called DEFINE unless there's already a conventional name for such a word in implementations that have it). There's also the whole need to juggle the target wordlist into the "current wordlist" position instead of having FIND and DEFINE simply take a wid argument.