Sujet : Re: single-xt approach in the standard
De : anton (at) *nospam* mips.complang.tuwien.ac.at (Anton Ertl)
Groupes : comp.lang.forthDate : 22. Sep 2024, 18:13:42
Autres entêtes
Organisation : Institut fuer Computersprachen, Technische Universitaet Wien
Message-ID : <2024Sep22.191342@mips.complang.tuwien.ac.at>
References : 1 2 3 4 5 6 7
User-Agent : xrn 10.11
Ruvim <
ruvim.pinka@gmail.com> writes:
- All standard programs are single-xt programs (in the part of
user-defined words). Why we should remove the way to document this
programs/words in the standard terms of interpretation semantics,
compilation semantics and execution semantics?
Who proposes removing that? I often write about the interpretatation
and compilation semantics of various words with default compilation
semantics or with immediate compilation semantics, and I see nobody
who wants to remove that possibility.
Examples:
: foo 1 ;
The execution semantics of FOO are to push 1 on the data stack.
The interpretation semantics of FOO are to push 1 on the data stack.
The compilation semantics of FOO are append the execution semantics of
FOO to the current definition.
: bar state @ ; immediate
The execution semantics of BAR are to push the contents of STATE on
the data stack.
The interpretation semantics of BAR are to push the contents of STATE
on the data stack.
The compilation semantics of BAR are to push the contents of STATE on
the data stack.
With that we can then determine what code like
: bla postpone bar ; immediate
bla . \ prints 0
] bla [ . \ prints -1
should do; I show the output in comments. I just tested gforth,
iforth, SwiftForth, and VFX Forth, and unsurprisingly they all produce
the output shown in the comments.
- anton
-- M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.htmlcomp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html New standard: https://forth-standard.org/ EuroForth 2024: https://euro.theforth.net