gforth Questions
1
Solved
In C, local variables exist inside of a function and contain the values like this:
void main(){
int a = 5;
int b = 9;
}
In the Gforth manual, they describe the local variables like this:
: swap ...
1
Solved
I would like to exit a Forth program (using Gforth 0.7.3) with a non-zero exit status.
I've tried:
1 bye
But the 1 is not interpreted as an argument to bye (and I didn't expect this to work anyway...
4
Solved
I'm trying to store a string value into a variable. To define the variable, I use:
: define CREATE 0 , ;
define x
I can easily store an integer/float value to x using
10 x !
or
10.0e x f!
...
4
I am preparing overall knowledge on building a Forth interpreter and want to disassemble some of the generic Forth code words such as +, -, *, etc.
My Gforth (I currently have version 0.7.3, inst...
2
Solved
In Forth, is there a common word to conditionally exit a procedure (return) if the top of the stack is zero? I was thinking of using this in recursive procedures instead of IF.
3
Is there an equivalent to forget word of Forth in Gforth?
I've seen about marker, but it doesn't have the same behaviour. Also the list command doesn't seem to give a listing of the program.
I'd li...
1
Solved
As default, Forth has only a little amount of working libraries so that everything has to be programmed from scratch. The reason is, that the stackbased Forth virtual machine identifies itself as a...
2
Solved
A simple question that turned out to be quite complex:
How do I turn a float to a String in GForth? The desired behavior would look something like this:
1.2345e fToString \ takes 1.2345e from the...
2
Solved
I have used CREATE to create an array of strings:
create mystringarray s" This" , s" is" , s" a", s" list" ,
And I want to sort this in ascending order. I've found some tutorials for assembly la...
1
Solved
I have a simple local variable in Forth:
: subtraction { a b } a b - ;
I would like to assign the output of
a b -
to another variable, say c.
Is this possible?
2
Solved
Forth famously allows users to alter the language by defining new words for control flow (beyond those given by the standard: DO, LOOP, BEGIN, UNTIL, WHILE, REPEAT, LEAVE IF, THEN, ELSE, CASE, ENDC...
Speakeasy asked 30/6, 2017 at 17:31
1
Solved
Is it possible to get the list of all words which are currently defined in Forth (for example in Gforth)?
2
Solved
On Rosetta Code there is no implementation of Y-combinator in Forth.
How can I do that? How do I use Y-combinator in Forth? And why?
Geriatrician asked 4/2, 2016 at 11:30
1
Solved
I have a mysterious error with an algorithm for subtraction of unsigned integers of various lengths. It works for almost every pair of numbers, but if n isn't smaller than the number of bits in a c...
Samora asked 6/10, 2015 at 17:29
1
Solved
I'd like to write a while() loop in Gforth. Unfortunately, the only tutorial online isn't useful due to a lack of examples, and examples on counted loops (what I'm not looking for) appear fundament...
3
Every Common Lisp programmer knows that macros are a powerful tool. Common Lisp macros have been used, among other things, to add object orientation on top of Lisp without changing the language spe...
Yeo asked 18/6, 2014 at 9:39
1
Solved
In Gforth, is there a way to add an integer value to a floating point value?
Something like 1 + 2.1? If I do 1 2.1e f+ I get an error which I'm guessing is because the values are not on the same ...
1
Solved
I've been looking around and haven't found a syntax definition for Gforth to use in Sublime Text.
Is there one? I have found one for TextPad, but that's about it (see TextPad syntax definitions). ...
Dagney asked 15/1, 2013 at 8:30
1
© 2022 - 2024 — McMap. All rights reserved.