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

Control-flow stack for i, j, leave, unloop #7

Open
ruv opened this issue Oct 2, 2023 · 1 comment
Open

Control-flow stack for i, j, leave, unloop #7

ruv opened this issue Oct 2, 2023 · 1 comment
Labels
enhancement New feature or request inconsistency Something is inconsistent with something else

Comments

@ruv
Copy link
Collaborator

ruv commented Oct 2, 2023

When the compilation semantics for the words i, j, leave, unloop are performed, at least one do-sys must be present on the control-flow stack (and two do-sys in the case of j).

But currently a system cannot check this fact and cannot throw an exception if these words are used not within do...loop, because the control-flow stack diagram is not specified for compilation semantics. A system may only check in run-time if loop-sys is present on the top of the return stack and throw an exception if not — since loop-sys is specified in the stack diagrams.

We should specify compilation semantics for these words, with control-flow stack diagrams like: ( C: do-sys i*x -- do-sys i*x ), or ( C: do-sys2 i*x do-sys1 j*x -- do-sys2 i*x do-sys1 j*x ) for the word j.

It will allow a system to formally check do-sys at compile-time and throw an exception if these words are used incorrectly in compile-time (according to 3.1, which says: "An ambiguous condition exists if an incorrectly typed data object is encountered").

See also

@ruv ruv added enhancement New feature or request inconsistency Something is inconsistent with something else labels Oct 2, 2023
@ruv
Copy link
Collaborator Author

ruv commented May 8, 2024

A similar issue exists for the of word.
Currently the spec says:

Compilation: ( C: -- of-sys )

But it should say:

Compilation: ( C: case-sys -- case-sys of-sys )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request inconsistency Something is inconsistent with something else
Projects
None yet
Development

No branches or pull requests

1 participant