Post by Anthony HoweDo you think that the Forth standard should recognize the classic single-xt
approach as possible for implementing a standard Forth system?
The classic single-xt approach implies that only one execution token (xt) is
associated with a name token (nt), and only one name token is associated with a
word (a named Forth definition). And words whose compilation semantics differ
form default compilation semantics are implemented as immediate words.
Given I prefer single-xt (currently), what I don't get is how for a dual-xt
system you define a single word with two actions for interpret and compile.
If you want the interpretation and compilation semantics,
NAME>INTERPRET gives you the interpretation semantics of the word, and
NAME>COMPILE gives you the compilation semantics.
Post by Anthony HoweI
don't see a word to distinguish between the two, except maybe IMMEDIATE.
There is no standardized way to define words with arbitrary
combinations of interpretation and compilation semantics. I don't
consider this to be a problem. We would need such words only for
defining words like S", and we don't need additional words of this
kind.
If you want to see where going for full support for defining arbitrary
combinations leads, read our EuroForth 2019 paper [paysan&ertl19].
@InProceedings{paysan&ertl19,
author = {Bernd Paysan and M. Anton Ertl},
title = {The new {Gforth} Header},
crossref = {euroforth19},
pages = {5--20},
url = {http://www.euroforth.org/ef19/papers/paysan.pdf},
url-slides = {http://www.euroforth.org/ef19/papers/paysan-slides.pdf},
video = {https://wiki.forth-ev.de/doku.php/events:ef2019:header},
OPTnote = {refereed},
abstract = {The new Gforth header is designed to directly
implement the requirements of Forth-94 and
Forth-2012. Every header is an object with a fixed
set of fields (code, parameter, count, name, link)
and methods (\texttt{execute}, \texttt{compile,},
\texttt{(to)}, \texttt{defer@}, \texttt{does},
\texttt{name>interpret}, \texttt{name>compile},
\texttt{name>string}, \texttt{name>link}). The
implementation of each method can be changed
per-word (prototype-based object-oriented
programming). We demonstrate how to use these
features to implement optimization of constants,
\texttt{fvalue}, \texttt{defer}, \texttt{immediate},
\texttt{to} and other dual-semantics words, and
\texttt{synonym}.}
}
@Proceedings{euroforth19,
title = {35th EuroForth Conference},
booktitle = {35th EuroForth Conference},
year = {2019},
key = {EuroForth'19},
url = {http://www.euroforth.org/ef19/papers/proceedings.pdf}
}
Post by Anthony Howe: s" ( "ccc" -- sd | )
[char] " parse
; immediate
This definition does not implement the standard word CORE S" or FILE
S" (maybe if he redefined NAME>INTERPRET and NAME>COMPILE, and
consequently POSTPONE, and ', but he doesn't do that).
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.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