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


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

VFX error?

Started byjzakiya@gmail.com
First post2014-10-09 21:47 -0700
Last post2014-10-11 21:04 -0700
Articles 20 on this page of 21 — 13 participants

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


Contents

  VFX error? jzakiya@gmail.com - 2014-10-09 21:47 -0700
    Re: VFX error? Michael Barry <barrym95838@yahoo.com> - 2014-10-09 22:08 -0700
    Re: VFX error? Bruno Gauthier <bgauthier@free.fr> - 2014-10-10 07:17 +0200
    Re: VFX error? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-10-10 07:33 +0000
      Re: VFX error? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-10-10 10:10 +0000
        Re: VFX error? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-10-10 10:39 +0000
      Re: VFX error? "Rod Pemberton" <buzzoff@nonamewhichexists.cmm> - 2014-10-17 22:04 -0400
    Re: VFX error? Andrew Haley <andrew29@littlepinkcloud.invalid> - 2014-10-10 03:06 -0500
    Re: VFX error? francois.ganza@wanadoo.fr - 2014-10-10 01:47 -0700
      Re: VFX error? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2014-10-10 10:36 +0000
      Re: VFX error? stephenXXX@mpeforth.com (Stephen Pelc) - 2014-10-10 13:34 +0000
        Re: VFX error? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-10-10 15:09 +0000
    Re: VFX error? stephenXXX@mpeforth.com (Stephen Pelc) - 2014-10-10 13:26 +0000
      Re: VFX error? jzakiya@gmail.com - 2014-10-10 12:41 -0700
      Re: VFX error? "Rod Pemberton" <buzzoff@nonamewhichexists.cmm> - 2014-10-17 22:09 -0400
      Re: VFX error? Just Ian <superian@gmail.com> - 2014-10-22 08:25 -0700
        Re: VFX error? Coos Haak <chforth@hccnet.nl> - 2014-10-22 21:14 +0200
        Re: VFX error? albert@spenarnc.xs4all.nl (Albert van der Horst) - 2014-10-22 20:40 +0000
        Re: VFX error? hughaguilar96@yahoo.com - 2014-10-22 20:14 -0700
    Re: VFX error? francois.ganza@wanadoo.fr - 2014-10-11 15:31 -0700
    Re: VFX error? Julian Fondren <julian.fondren@gmail.com> - 2014-10-11 21:04 -0700

Page 1 of 2  [1] 2  Next page →


#33801 — VFX error?

Fromjzakiya@gmail.com
Date2014-10-09 21:47 -0700
SubjectVFX error?
Message-ID<5b5849fc-0165-4eef-8ddb-833862c3adde@googlegroups.com>
For some reason when I do this:

hex

create xxx 11 c, 34 c, FE c, .... CD c, ....

the compiler throws an error. To get around it I can do this:

create xxx 11 c, 34 c, FE c, .... 0CD c, ....

but that's such a cludge hack.  Why does this happen?

[toc] | [next] | [standalone]


#33803

FromMichael Barry <barrym95838@yahoo.com>
Date2014-10-09 22:08 -0700
Message-ID<b4f51d12-e024-4a89-8344-7e815029a2b3@googlegroups.com>
In reply to#33801
Could it be some sort of dictionary name collision?  Numeric constants are last in the search order of most FINDs , regardless of radix, correct?

Mike

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


#33804

FromBruno Gauthier <bgauthier@free.fr>
Date2014-10-10 07:17 +0200
Message-ID<54376bfd$0$2338$426a34cc@news.free.fr>
In reply to#33801
Le 10/10/2014 06:47, jzakiya@gmail.com a écrit :
> For some reason when I do this:
>
> hex
>
> create xxx 11 c, 34 c, FE c, .... CD c, ....
>
> the compiler throws an error. To get around it I can do this:
>
> create xxx 11 c, 34 c, FE c, .... 0CD c, ....
>
> but that's such a cludge hack.  Why does this happen?
>
cd = change or current directory like a pc DOS command

examples
cd
C:\Users\BRUNO\FORTH\vfxForth\Bin ok
cd ..  ok
cd
C:\Users\BRUNO\FORTH\vfxForth ok
cd c:\Users\BRUNO\FORTH\vfxForth\examples  ok
cd
c:\Users\BRUNO\FORTH\vfxForth\examples ok
cd \ ok
cd
c:\ ok

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


#33805

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2014-10-10 07:33 +0000
Message-ID<2014Oct10.093331@mips.complang.tuwien.ac.at>
In reply to#33801
jzakiya@gmail.com writes:
>For some reason when I do this:
>
>hex
>
>create xxx 11 c, 34 c, FE c, .... CD c, ....
>
>the compiler throws an error. To get around it I can do this:
>
>create xxx 11 c, 34 c, FE c, .... 0CD c, ....
>
>but that's such a cludge hack.  Why does this happen?

As someone else explained, there is a word CD in VFX, and that
collides.  Prepending a 0 to a hex number is traditional Forth
practice to avoid that problem, and used to be recommended for all hex
numbers, whether there is a known collision or not.  These days you
can write $cd (no need to use HEX), and I recommend using that.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2014: http://www.euroforth.org/ef14/

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


#33808

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2014-10-10 10:10 +0000
Message-ID<5437b07e$0$15866$e4fe514c@dreader35.news.xs4all.nl>
In reply to#33805
In article <2014Oct10.093331@mips.complang.tuwien.ac.at>,
Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
>jzakiya@gmail.com writes:
>>For some reason when I do this:
>>
>>hex
>>
>>create xxx 11 c, 34 c, FE c, .... CD c, ....
>>
>>the compiler throws an error. To get around it I can do this:
>>
>>create xxx 11 c, 34 c, FE c, .... 0CD c, ....
>>
>>but that's such a cludge hack.  Why does this happen?
>
>As someone else explained, there is a word CD in VFX, and that
>collides.  Prepending a 0 to a hex number is traditional Forth
>practice to avoid that problem, and used to be recommended for all hex
>numbers, whether there is a known collision or not.  These days you
>can write $cd (no need to use HEX), and I recommend using that.

I can't see how the $ helps.

Suppose we have a word to go to a directory with a named string

: cdED  ZEN HERE HERE __NR_chdir XOS ?ERRUR ;

use it like
  "euler" cdED

Now define

: $cd  PARSE-NAME cdED ;

>
>- anton

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]


#33810

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2014-10-10 10:39 +0000
Message-ID<2014Oct10.123947@mips.complang.tuwien.ac.at>
In reply to#33808
albert@spenarnc.xs4all.nl (Albert van der Horst) writes:
>>As someone else explained, there is a word CD in VFX, and that
>>collides.  Prepending a 0 to a hex number is traditional Forth
>>practice to avoid that problem, and used to be recommended for all hex
>>numbers, whether there is a known collision or not.  These days you
>>can write $cd (no need to use HEX), and I recommend using that.
>
>I can't see how the $ helps.

It does not conflict with any word that consists of letters only.

>Suppose we have a word to go to a directory with a named string
>
>: cdED  ZEN HERE HERE __NR_chdir XOS ?ERRUR ;
>
>use it like
>  "euler" cdED
>
>Now define
>
>: $cd  PARSE-NAME cdED ;

Sure, you can define words with any name, so for any way to recognize
a hex number, you could contrive a word that shadows a hex number.
However, words consisting of letters only are much more common, and
there is no word in the standard that starts with $.

$ is used as hex prefix in a number of assemblers, and more
importantly, it was in wide use in Forth systems as hex prefix when I
made the proposal.  Ok, $ is used as string prefix in BASIC and
(probably inspired by that) by some Forth programmers, but, as
discussed above, there is no absolutely safe alternative, and the $
prefix looked best and still looks best to me, given all the things to
consider.

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2014: http://www.euroforth.org/ef14/

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


#33996

From"Rod Pemberton" <buzzoff@nonamewhichexists.cmm>
Date2014-10-17 22:04 -0400
Message-ID<op.xnwlecpfmk81un@localhost>
In reply to#33805
On Fri, 10 Oct 2014 03:33:31 -0400, Anton Ertl  
<anton@mips.complang.tuwien.ac.at> wrote:

> jzakiya@gmail.com writes:
>> For some reason when I do this:
>>
>> hex
>>
>> create xxx 11 c, 34 c, FE c, .... CD c, ....
>>
>> the compiler throws an error. To get around it I can do this:
>>
>> create xxx 11 c, 34 c, FE c, .... 0CD c, ....
>>
>> but that's such a cludge hack.  Why does this happen?
>
> As someone else explained, there is a word CD in VFX, and that
> collides.  Prepending a 0 to a hex number is traditional Forth
> practice to avoid that problem, and used to be recommended for all hex
> numbers, whether there is a known collision or not.  These days you
> can write $cd (no need to use HEX), and I recommend using that.

The best solution is to require the system to not have any
constants defined which could conflict.  It should use some
other syntax which has no potential for conflicts.  E.g.,
con_CD or hex_CD etc.


Rod Pemberton

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


#33806

FromAndrew Haley <andrew29@littlepinkcloud.invalid>
Date2014-10-10 03:06 -0500
Message-ID<E5qdneBu8KUZDqrJnZ2dnUU7-Y-dnZ2d@supernews.com>
In reply to#33801
jzakiya@gmail.com wrote:
> For some reason when I do this:
> 
> hex
> 
> create xxx 11 c, 34 c, FE c, .... CD c, ....
> 
> the compiler throws an error. To get around it I can do this:
> 
> create xxx 11 c, 34 c, FE c, .... 0CD c, ....
> 
> but that's such a cludge hack.  Why does this happen?

It's very simple: always begin a number with a digit 0-9.

Andrew.

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


#33807

Fromfrancois.ganza@wanadoo.fr
Date2014-10-10 01:47 -0700
Message-ID<5231d8cd-5c2e-4227-8303-400431868788@googlegroups.com>
In reply to#33801
Why don't use an extension char for BASE ?

like "b", "o", "d" and  "h"

It's verry usefull for changing base in a word definition

Exemple :
(uppercase the first text line in text mode)

Standard Forth :

DECIMAL
: UPC_LINE0 ( --- )
  160 0 DO
    [ HEX] B800 [ DECIMAL ] I LC@
    DUP 96 > IF 32 - THEN
    [ HEX] B800 [ DECIMAL ] I LC!
   LOOP ;

the same with extensions

: UPC_LINE0 ( --- )
  160 0 DO
    B800h I LC@
    DUP 96 > IF 32 - THEN
    B800h I LC!
   LOOP ;

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


#33809

Fromanton@mips.complang.tuwien.ac.at (Anton Ertl)
Date2014-10-10 10:36 +0000
Message-ID<2014Oct10.123633@mips.complang.tuwien.ac.at>
In reply to#33807
francois.ganza@wanadoo.fr writes:
>Why don't use an extension char for BASE ?
>
>like "b", "o", "d" and  "h"

b and d are valid hex digits, and h and o are valid digits for higher
bases.  After decimal 18 base !, the meaning of the following code
would be unclear:

>: UPC_LINE0 ( --- )
>  160 0 DO
>    B800h I LC@
>    DUP 96 > IF 32 - THEN
>    B800h I LC!
>   LOOP ;
>

- anton
-- 
M. Anton Ertl  http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
     New standard: http://www.forth200x.org/forth200x.html
   EuroForth 2014: http://www.euroforth.org/ef14/

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


#33812

FromstephenXXX@mpeforth.com (Stephen Pelc)
Date2014-10-10 13:34 +0000
Message-ID<5437df2c.623869198@news.demon.co.uk>
In reply to#33807
On Fri, 10 Oct 2014 01:47:10 -0700 (PDT), francois.ganza@wanadoo.fr
wrote:

>Why don't use an extension char for BASE ?
>
>like "b", "o", "d" and  "h"

Because these are all valid digits in some base or other. The prefix
notation is common practice in desktop Forths and so was standardised.
Other Forths, including VFX Forth, also support the 0xabcd notation.

Stephen


-- 
Stephen Pelc, stephenXXX@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads

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


#33816

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2014-10-10 15:09 +0000
Message-ID<5437f6b6$0$6850$e4fe514c@dreader36.news.xs4all.nl>
In reply to#33812
In article <5437df2c.623869198@news.demon.co.uk>,
Stephen Pelc <stephenXXX@mpeforth.com> wrote:
>On Fri, 10 Oct 2014 01:47:10 -0700 (PDT), francois.ganza@wanadoo.fr
>wrote:
>
>>Why don't use an extension char for BASE ?
>>
>>like "b", "o", "d" and  "h"
>
>Because these are all valid digits in some base or other. The prefix
>notation is common practice in desktop Forths and so was standardised.
>Other Forths, including VFX Forth, also support the 0xabcd notation.

In ciforth nothing is available in the kernel but you can do

WANT $-PREFIX    WANT ALIAS

'$ ALIAS 0x

(assuming lina -w that makes want available at startup)

>
>Stephen

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]


#33811

FromstephenXXX@mpeforth.com (Stephen Pelc)
Date2014-10-10 13:26 +0000
Message-ID<5437db67.622904051@news.demon.co.uk>
In reply to#33801
On Thu, 9 Oct 2014 21:47:04 -0700 (PDT), jzakiya@gmail.com wrote:

>For some reason when I do this:
>
>hex
>
>create xxx 11 c, 34 c, FE c, .... CD c, ....
>
>the compiler throws an error. To get around it I can do this:
>
>create xxx 11 c, 34 c, FE c, .... 0CD c, ....

The dictionary is searched before any number conversion is attempted.

There's a utility word CD ( -- ), e.g.
  CD \Users\Stephen
which is found and executed. It should be called CWD (Change
Working Directory) but it's been in our systems since long before
ANS or Forth-2012. House practice at MPE is not to use the base
switches but to use the base prefices and to start the number with a
leading 0.

  create xxx  ( -- addr ) $011 c, $034 c, $0FE c, ... $0CD c, ...

There are occasional conflicts with string words - there's even a
$CD in VFX Forth. Starting non-decimal numbers with a leading zero
keeps you out of trouble in nearly all cases.

Stephen

-- 
Stephen Pelc, stephenXXX@mpeforth.com
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads

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


#33824

Fromjzakiya@gmail.com
Date2014-10-10 12:41 -0700
Message-ID<906e282f-1c9f-4208-a8f8-3b2659a10ee1@googlegroups.com>
In reply to#33811
On Friday, October 10, 2014 9:26:25 AM UTC-4, Stephen Pelc wrote:
> On Thu, 9 Oct 2014 21:47:04 -0700 (PDT), jzakiya@gmail.com wrote:
> 
> 
> 
> >For some reason when I do this:
> 
> >
> 
> >hex
> 
> >
> 
> >create xxx 11 c, 34 c, FE c, .... CD c, ....
> 
> >
> 
> >the compiler throws an error. To get around it I can do this:
> 
> >
> 
> >create xxx 11 c, 34 c, FE c, .... 0CD c, ....
> 
> 
> 
> The dictionary is searched before any number conversion is attempted.
> 
> 
> 
> There's a utility word CD ( -- ), e.g.
> 
>   CD \Users\Stephen
> 
> which is found and executed. It should be called CWD (Change
> 
> Working Directory) but it's been in our systems since long before
> 
> ANS or Forth-2012. House practice at MPE is not to use the base
> 
> switches but to use the base prefices and to start the number with a
> 
> leading 0.
> 
> 
> 
>   create xxx  ( -- addr ) $011 c, $034 c, $0FE c, ... $0CD c, ...
> 
> 
> 
> There are occasional conflicts with string words - there's even a
> 
> $CD in VFX Forth. Starting non-decimal numbers with a leading zero
> 
> keeps you out of trouble in nearly all cases.
> 
> 
> 
> Stephen
> 
> 
> 
> -- 
> 
> Stephen Pelc, stephenXXX@mpeforth.com
> 
> MicroProcessor Engineering Ltd - More Real, Less Time
> 
> 133 Hill Lane, Southampton SO15 5AF, England
> 
> tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
> 
> web: http://www.mpeforth.com - free VFX Forth downloads

In SwiftForth 
this does not work:  0xabcd
but this does work:  $abcd

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


#33997

From"Rod Pemberton" <buzzoff@nonamewhichexists.cmm>
Date2014-10-17 22:09 -0400
Message-ID<op.xnwll5ibmk81un@localhost>
In reply to#33811
On Fri, 10 Oct 2014 09:26:32 -0400, Stephen Pelc <stephenXXX@mpeforth.com>  
wrote:
> On Thu, 9 Oct 2014 21:47:04 -0700 (PDT), jzakiya@gmail.com wrote:

>> For some reason when I do this:
>>
>> hex
>>
>> create xxx 11 c, 34 c, FE c, .... CD c, ....
>>
>> the compiler throws an error. To get around it I can do this:
>>
>> create xxx 11 c, 34 c, FE c, .... 0CD c, ....
>
> The dictionary is searched before any number conversion is attempted.
>
> There's a utility word CD ( -- ), e.g.
>   CD \Users\Stephen
> which is found and executed.

So ...

The answer to "VFX error?" is your system breaks his otherwise
valid code.  Yes?


Rod Pemberton

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


#34090

FromJust Ian <superian@gmail.com>
Date2014-10-22 08:25 -0700
Message-ID<e0558e0a-8561-4531-a609-f70d33944cc6@googlegroups.com>
In reply to#33811
Stephen Pelc said:

> The dictionary is searched before any number conversion is attempted.
> 
> There's a utility word CD ( -- ) 

This behaviour, which is of course completely normal, is an excuse to mention one of my favourite Forth bugs.

In a FORTH-83 LMI Forth, one word puts the double number 4043 on the stack. As it was part of ABORT, it's soon discarded without being used. But why do that?

It became clear when I realised that 4043 in DECIMAL is FCB in HEX. 

The original source code must have contained .FCB (the name of a word in LMI Forth to print a DOS File Control Block) but the metacompiler used to generate the Forth hadn't come across that word yet - it was later in the dictionary. 

The LMI metacompiler was smart enough to remember such words, and fill in the addresses later, but the dot made this one a valid double number, so it was treated as such... As the only cost was that the system was four bytes bigger than it would have been and didn't give some of the diagnostic info it was supposed to do, it escaped Ray's notice.

  Ian

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


#34091

FromCoos Haak <chforth@hccnet.nl>
Date2014-10-22 21:14 +0200
Message-ID<z862ml6v9fs2$.1f22xova31hk2.dlg@40tude.net>
In reply to#34090
Op Wed, 22 Oct 2014 08:25:47 -0700 (PDT) schreef Just Ian:

> Stephen Pelc said:
> 
>> The dictionary is searched before any number conversion is attempted.
>> 
>> There's a utility word CD ( -- ) 
> 
> This behaviour, which is of course completely normal, is an excuse to mention one of my favourite Forth bugs.
> 
> In a FORTH-83 LMI Forth, one word puts the double number 4043 on the stack. As it was part of ABORT, it's soon discarded without being used. But why do that?
> 
> It became clear when I realised that 4043 in DECIMAL is FCB in HEX. 
> 
> The original source code must have contained .FCB (the name of a word in LMI Forth to print a DOS File Control Block) but the metacompiler used to generate the Forth hadn't come across that word yet - it was later in the dictionary. 
> 
> The LMI metacompiler was smart enough to remember such words, and fill in the addresses later, but the dot made this one a valid double number, so it was treated as such... As the only cost was that the system was four bytes bigger than it would have been and didn't give some of the diagnostic info it was supposed to do, it escaped Ray's notice.
> 
>   Ian

I have another explanation.
From The Figforth Installation Manual and Glossary:
"
ERROR line --- in blk
  Execute error notification and restart of system. WARNING is first
  examined. If 1, the text of line n, relative to screen 4 of drive 0
  is printed. This line number may be positive or negative, and beyond
  just screen 4. If WARNING=O, n is just printed as a message number
  (non disc installation). If WARNING is -l, the definition (ABORT) is
  executed, which executes the system ABORT. The user may cautiously
  modify this execution by altering (ABORT).
  fig-FORTH saves the contents of IN and BLK to assist in determining
  the location of the error. Final action is execution of QUIT.
"

So, when an error occurs, these two numbers are placed on the stack.
I don't have the Figforth EDITOR wordlist here, but there was a word WHERE
that produces or accepts these two numbers to locate the source (i.e.
block) of the error.

-- 
Coos

CHForth, 16 bit DOS applications
http://home.hccnet.nl/j.j.haak/forth.html 

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


#34094

Fromalbert@spenarnc.xs4all.nl (Albert van der Horst)
Date2014-10-22 20:40 +0000
Message-ID<5448162d$0$6865$e4fe514c@dreader36.news.xs4all.nl>
In reply to#34090
In article <e0558e0a-8561-4531-a609-f70d33944cc6@googlegroups.com>,
Just Ian  <superian@gmail.com> wrote:
>Stephen Pelc said:
>
>> The dictionary is searched before any number conversion is attempted.
>>
>> There's a utility word CD ( -- )
>
>This behaviour, which is of course completely normal, is an excuse to
>mention one of my favourite Forth bugs.
>
>In a FORTH-83 LMI Forth, one word puts the double number 4043 on the
>stack. As it was part of ABORT, it's soon discarded without being used.
>But why do that?
>
>It became clear when I realised that 4043 in DECIMAL is FCB in HEX.
>
>The original source code must have contained .FCB (the name of a word in
>LMI Forth to print a DOS File Control Block) but the metacompiler used
>to generate the Forth hadn't come across that word yet - it was later in
>the dictionary.
>
>The LMI metacompiler was smart enough to remember such words, and fill
>in the addresses later, but the dot made this one a valid double number,
>so it was treated as such... As the only cost was that the system was
>four bytes bigger than it would have been and didn't give some of the
>diagnostic info it was supposed to do, it escaped Ray's notice.

My numbers always want a recognizer which is 0-9 or +-.
This system is easy for Forth to understand. And as a side effect it is
for humans easy to not make mistakes.
I'm all in favor of simple rules:
if it starts with a digit or a sign it is a number. (Replace 2SWAP by PSWAP)
If the number contains a _ (was e) it is floating point.
If it doesn't and it contains a . it is double precision int.

It is so simple that hex floating point becomes a possibility.

>
>  Ian


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]


#34106

Fromhughaguilar96@yahoo.com
Date2014-10-22 20:14 -0700
Message-ID<f5e9e8e4-719b-4b0f-b183-fecbbba22009@googlegroups.com>
In reply to#34090
On Wednesday, October 22, 2014 8:25:47 AM UTC-7, Just Ian wrote:
> Stephen Pelc said:
> 
> > The dictionary is searched before any number conversion is attempted.
> > 
> > There's a utility word CD ( -- ) 
> 
> This behaviour, which is of course completely normal, is an excuse to mention one of my favourite Forth bugs.
> 
> In a FORTH-83 LMI Forth, one word puts the double number 4043 on the stack. As it was part of ABORT, it's soon discarded without being used. But why do that?
> 
> It became clear when I realised that 4043 in DECIMAL is FCB in HEX. 
> 
> The original source code must have contained .FCB (the name of a word in LMI Forth to print a DOS File Control Block) but the metacompiler used to generate the Forth hadn't come across that word yet - it was later in the dictionary. 
> 
> The LMI metacompiler was smart enough to remember such words, and fill in the addresses later, but the dot made this one a valid double number, so it was treated as such... As the only cost was that the system was four bytes bigger than it would have been and didn't give some of the diagnostic info it was supposed to do, it escaped Ray's notice.
> 
>   Ian

Metacompiler? You are talking about LMI's cross-compiler?

I don't recall anything like this in the MS-DOS UR/Forth that I used --- although it may have escaped my notice too.

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


#33849

Fromfrancois.ganza@wanadoo.fr
Date2014-10-11 15:31 -0700
Message-ID<74faa829-7a65-4665-b2b0-7c1ebf836ee2@googlegroups.com>
In reply to#33801
Ok, in fact my Forth is case sensitive, i can't write "abcd" :p

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


Page 1 of 2  [1] 2  Next page →

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


csiph-web