|
|
 | | From: | Alex McDonald | | Subject: | Default & non-default compilation semantics | | Date: | 17 Jan 2005 14:11:14 -0800 |
|
|
 | In http://www.complang.tuwien.ac.at/forth/dpans-html/comment-semantics.html in the Implementations strategies section, there's a statement that intrigues (that is, confuses) me. In a traditional xt is CFA, immediate flag forth;
"Words without interpretation semantics and with default compilation semantics (e.g., EXIT) can be implemented as non-immediate; you cannot implement them as immediate words if you support [COMPILE]."
Does this mean "you cannot [COMPILE] EXIT" if EXIT is immediate?
Clarification of the definition of "non-default compilation semantics" might help; I can't see the difference between IF and EXIT. Neither have interpretation semantics; why are the compilation semantics of IF non-default?
-- Regards Alex McDonald
|
|
 | | From: | Anton Ertl | | Subject: | Re: Default & non-default compilation semantics | | Date: | Mon, 17 Jan 2005 22:29:11 GMT |
|
|
 | "Alex McDonald" writes: >In >http://www.complang.tuwien.ac.at/forth/dpans-html/comment-semantics.html >in the Implementations strategies section, there's a statement that >intrigues (that is, confuses) me. In a traditional xt is CFA, immediate >flag forth; > >"Words without interpretation semantics and with default compilation >semantics (e.g., EXIT) can be implemented as non-immediate; you cannot >implement them as immediate words if you support [COMPILE]." > >Does this mean "you cannot [COMPILE] EXIT" if EXIT is immediate?
What the system will do in that case is not what the standard requires (though I don't think that the TC did this intentionally; it's rather a side effect of the fact that [COMPILE] does not quite fit the semantics model).
To make this more concrete, consider two simple implementations of EXIT:
' ;s alias EXIT1
: EXIT2 POSTPONE ;s ; immediate
Now consider what happens when you [COMPILE] these EXITs. There is a difference between these EXITs. The way EXIT and [COMPILE] are defined in the standard, the required behaviour is to behave like [COMPILE] EXIT1.
>Clarification of the definition of "non-default compilation semantics" >might help; I can't see the difference between IF and EXIT. Neither >have interpretation semantics; why are the compilation semantics of IF >non-default?
The definitions of these words in the standard are different:
- For IF, no execution semantics is defined (and therefore there is no default compilation semantics), and compilation semantics is defined directly (not through the default mechanism). I consider this to be non-default compilation semantics (and that's necessary for [COMPILE] IF to work in the traditional way).
- For EXIT, execution semantics is defined, and the compilation semantics is the default compilation semantics defined in 3.4.3.3.
- 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: http://www.complang.tuwien.ac.at/forth/ansforth/forth200x.html
|
|
|