Skip to content
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

STATE in not maintained consistently #5

Open
frenchie68 opened this issue Jun 10, 2022 · 5 comments
Open

STATE in not maintained consistently #5

frenchie68 opened this issue Jun 10, 2022 · 5 comments

Comments

@frenchie68
Copy link

frenchie68 commented Jun 10, 2022

Hi Travis,

I have been somehow challenged to prove the value of your output. I believe it is promising but you are not quite there yet. You seem to adhere, in a way, to the ANS-94 standard specification but you're not there yet. I tried to run some OTS benchmarks on your platform on the STM32F411RE. Although it is not officially supported, this test pattern ought to work yet it does not:

reboot
Welcome to zeptoforth
Built for stm32f411, version 0.39.0, on Sat Jun 4 08:15:17 PM CDT 2022
zeptoforth comes with ABSOLUTELY NO WARRANTY: for details type `license'
ok
DECIMAL ok
: dfib1 ( d1 -- d2 ) ok
2DUP 2 0 D< IF ok
2DROP 1 0 ok
ELSE ok
2DUP ok
-1 -1 D+ RECURSE ok
2SWAP -2 -1 D+ RECURSE ok
D+ ok
THEN ; ok
systick import ok
enable-systick ok
ok
variable st-start ok
variable st-end ok
systick-counter st-start ! ok
34 0 dfib1 d. 9227465 ok
systick-counter st-end ! ok
CR st-end @ st-start @ - 10 * . ." ms"
4038500 not compiling

How come?

@tabemann
Copy link
Owner

I should note that ." does not work when STATE is 0, which is per standard. I also should warn you that while zeptoforth is pretty close to ANS, it does not make a concerted effort to follow ANS in every way (e.g. it uses NOT rather than INVERT because INVERT is an abomination, and it uses [IMMEDIATE] and [COMPILE-ONLY] within words rather than IMMEDIATE and COMPILE-ONLY after words due to issues imposed by compiling to flash).

@tabemann
Copy link
Owner

If you want to print a constant string at the REPL, use .(, which of course is closed with ), to print it, because .( is immediate.

@tabemann
Copy link
Owner

I should note that while zeptoforth does support S" and C" at the REPL, these are highly non-standard, and impose their own restrictions (i.e. because it stores the strings in temporary buffers that eventually get reused for more temporary strings).

@tabemann
Copy link
Owner

I have made a new release, 0.40.0, which adds ." and .\" at the REPL level, so one is no longer required to be in a compilation state to use them (in full builds at least - in kernel-only and mini builds compilation state is still required).

@frenchie68
Copy link
Author

Thanks Travis. /MOD (on the F411) and .S now look good to me. I haven't run extensive tests but as far as I can tell, they are good to go. Do you implement floored division? That's also a big thing since FORTH-83.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants