Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #29321
| From | Lauri Alanko <la@iki.fi> |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Which input to use? |
| Date | 2014-04-06 14:13 +0000 |
| Organization | University of Helsinki |
| Message-ID | <lhrndd$2pa$1@speranza.aioe.org> (permalink) |
Hello. I'm a bit confused by the design of Forth's input system. If I read the Forth 2012 draft correctly, we have the following: * The user input device. This is just some system-dependent input source that is read with KEY and ACCEPT. * Files. These are read with READ-FILE and READ-LINE. * The input source. This is used by parsing words during interpretation. The input source is accessed through the input buffer with SOURCE, >IN and REFILL. This all seems terribly complicated from the programmer's point of view. What if I just want to write general-purpose text processing code that can be used with arbitrary inputs? Now it seems I have to write a separate abstraction layer to deal with the above cases. I would have expected there to be either a way to make a file into the user input device, or to treat the user input device as a file, so one could use a single interface uniformly. Funnily enough, there is one abstraction layer already in place: the input source, which can be set to read either from the user input device (with QUIT) or from a file (with INCLUDE-FILE). It even has a number of useful parsing primitives available already. But unfortunately it seems that there is no way to change the input source without starting to interpret it immediately. So it seems that the input source cannot be used as an input abstraction layer if we are reading data that isn't structured as Forth words. Have I understood the situation correctly? Is there some reason for these limitations? Lauri
Back to comp.lang.forth | Previous | Next — Next in thread | Find similar | Unroll thread
Which input to use? Lauri Alanko <la@iki.fi> - 2014-04-06 14:13 +0000
Re: Which input to use? mhx@iae.nl - 2014-04-06 07:59 -0700
Re: Which input to use? "Elizabeth D. Rather" <erather@forth.com> - 2014-04-06 08:26 -1000
Re: Which input to use? hughaguilar96@yahoo.com - 2014-04-19 19:48 -0700
Re: Which input to use? "Alex McDonald" <blog@rivadpm.com> - 2014-04-21 02:09 +0100
Re: Which input to use? "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-04-21 04:01 -0400
Re: Which input to use? hughaguilar96@yahoo.com - 2014-04-06 23:16 -0700
Re: Which input to use? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-04-07 10:44 +0000
Re: Which input to use? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-04-07 17:45 +0000
Re: Which input to use? mhx@iae.nl - 2014-04-07 12:09 -0700
Re: Which input to use? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-04-08 16:11 +0000
Re: Which input to use? mhx@iae.nl - 2014-04-08 13:05 -0700
Re: Which input to use? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-04-08 03:18 -0500
Re: Which input to use? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-04-08 10:49 +0000
Re: Which input to use? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-04-09 16:07 +0000
Re: Which input to use? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-04-10 01:36 +0000
Re: Which input to use? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-04-11 17:59 +0000
Re: Which input to use? "Alex McDonald" <blog@rivadpm.com> - 2014-04-08 12:28 +0100
Re: Which input to use? hughaguilar96@yahoo.com - 2014-04-08 21:03 -0700
Re: Which input to use? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-04-09 03:14 -0500
EXECUTE-PARSING (was: Which input to use?) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-04-09 15:13 +0000
Re: EXECUTE-PARSING (was: Which input to use?) Bernd Paysan <bernd.paysan@gmx.de> - 2014-04-09 18:54 +0200
Re: EXECUTE-PARSING (was: Which input to use?) Alexander Skobelev <al.skobelev@gmail.com> - 2014-04-09 22:44 -0700
csiph-web