-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fedora Core 25 x86 64 bits target #60
Comments
By default, the bootstrap Forth is built with the 32-bit GCC toolchain. For that, you will have to install build dependencies such as 32-bit libraries and header files. I don't know how to do that for Fedora. But removing -m32 to get a 64-bit build works equally well.
Yes. I have looked into it, and concluded it was harmless. I recall it was only during the bootstrap.
You're right. I'll make a separate issue for that.
Yes, that's the intention.
This is probably issue #55. Can you build a native Forth, e.g.
No, they are not supposed to be lost. Can you provide a specific example?
No, it doesn't. I never felt any need to use locals, to that file is just a stub. |
Yes, issue #55 is the same thing. I tried the subdirectories again, and it seems to work (I might have confused it with the 23 character truncation). It seems parallel build causes problems:
I tried
It then claims nothing is to be done:
It’s easy to get tripped-up in some unbuildable state. Trying just
Trying
|
Small functions like gcd and lcm are perhaps somewhat manageable without locals: : gcd ( n1 n2 -- n3 ) begin ?dup while tuck mod repeat abs ;
: lcm ( n1 n2 -- n3 ) 2dup * abs -rot gcd / ; But the extended Euclidean algorithm is another matter where 7 numbers are involved in various ways. One of them is tacit here: : extended-gcd ( n1 n2 -- n3 n4 n5 )
1 0 0 1 { n m d c b a }
begin m 0<>
while n s>d m sm/rem nip ( Symmetric division is required: n m / )
dup a * c swap - to c
dup b * d swap - to d
m * n swap - to n
a c to a to c
b d to b to d
m n to m to n
repeat n 0< if d negate c negate n negate else d c n then ; The gcd for Gaussian integers is yet another step up in complexity. :) I’ve made a Scheme version but haven’t translated it to Forth yet: (define (extended-gcd w z)
(letrec ((loop
(lambda (w z a b c d)
; Solve [ a b | w ]
; [ c d | z ].
(cond ((= w 0) (values z c d))
((= z 0) (values w a b))
((or (<= (real-part w) 0) (< (imag-part w) 0))
(loop (* w 0+i) z (* a 0+i) (* b 0+i) c d))
((or (<= (real-part z) 0) (< (imag-part z) 0))
(loop w (* z 0+i) a b (* c 0+i) (* d 0+i)))
((<= (magnitude w) (magnitude z))
(let ((q (floor (/ (magnitude z) (magnitude w)))))
(loop w (- z (* w q)) a b (- c (* a q)) (- d (* b q)))))
(else (loop z w c d a b))))))
(loop w z 1 0 0 1))) This Euler phi function is almost completely tacit: : euler-phi ( n1 -- n2 )
1 { p } factor-exponents 0 ?do
2dup ** -rot 1- ** - p * to p
loop p ; I now came up with this alternative but I’m unsure readability improves: : euler-phi ( n1 -- n2 )
factor-exponents 1 swap 0 ?do >r 2dup ** -rot 1- ** - r> * loop ; |
I have never tried parallel builds before, but now that I do, I see there is a problem. |
There's a quirk with the build system. You should always pass the same values of |
Regarding locals, I'm not opposed to providing them as a loadable extension, but it's not a priority. Not having locals is also a way to encourage learning to write Forth without them. |
I’m a bit confused as to whether the “ignored” error (from complete compiler log above) in
using |
Yes, people do understandably get confused by that. The reason is there are two ways the Forth image can be rebuilt. The bootstrap Forth writes it to stdout, hence the In the first case, no file called You can verify that the binary works by running |
Thanks,
Paths on the x86 target seem to be truncated at 44 characters instead of 23 of the other target:
|
Ah, that's right. I forgot there is a limit there too. I added this information to #55. |
I think this can be closed. There are sepate issues for each of the problems. |
I thought it would be interesting to try out lbForth. Target is Fedora Core 25 x86 64 bits and here are my notes:
-m32
in targets/c/forth.mk (see compiler log below).s" /some/dir/..." searched
to make lbForth find source files of interest. Not sure if this is correct but it did seem to work.require
subdirectories seems to be lost, so thatfoo
inrequire foo/bar.fth
is ignored?Undefined: {
.The text was updated successfully, but these errors were encountered: