gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gforth] how to use literal?


From: Ethan Gardener
Subject: [gforth] how to use literal?
Date: Fri, 14 Sep 2018 09:54:47 +0100

i thought literal's compilation semantics are to take a number from the stack 
and compile it into the definition so it's pushed at run-time.  i'm getting 
errors when i try to use it that way.  there are 2 simple examples below.  (i 
know i could have used 2constant instead of these definitions, i had just woken 
up.  anyway, these are simple repeatable examples.)  

these are from 0.7.0.  i get much the same errors on my phone with gforth 
0.7.9_20180905.  the first describes the error as "Control structure mismatch" 
and references glocals.fs:625:5 .  there's no intentional involvement with 
local variables here at all.  the second references unix/libc.fs:107:44 .


C:\gforth>gforth eekee.fs
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
here 1024 allot : mypad literal 1024 ;
:1: unstructured
here 1024 allot : mypad literal 1024 >>>;<<<
Backtrace:
$7EBA2B0C throw
$7EBAB804 c(abort")
$7EBB2DD8 def?
$7EBA79D0 ;-hook


C:\gforth>gforth eekee.fs
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
: mypad [ here 1024 allot ] literal 1024 ;  ok
mypad .s
:2: Invalid memory address
>>>mypad<<< .s
Backtrace:
$7EBA4F38 execute



reply via email to

[Prev in Thread] Current Thread [Next in Thread]