Josh Grams <josh@[EMAIL PROTECTED]
> writes:
>I *think* that what I normally want as a programmer
>is a distinction between syntax and semantics (parse time and
>"run" time).
>
>For instance, I want the behavior of S" to be: parse a string
>delimited by a double-quote, and add a string literal to the
>current "statement", regardless of whether or not I'm inside a
>definition.
Yes, that's something that I suggested in Section 5.4 of
<http://www.complang.tuwien.ac.at/papers/ertl98.ps.gz>:
One could divide parsing words into three parts:
1) the part performed at parse time: PARSE
2) the part performed at run-time: RUN
3) and part called STORE in the paper: it connects the two other parts
by taking the data generated at parsing time and time-shifting it by
one level. This would typically be LITERAL or something simular.
Depending on whether we want to have interpretation semantics,
compilation semantics, or postponing semantics (for "]] ... [["), the
text interpreter would use different numbers of store actions. Here's
how the text interpreter would implement the various semantics of such
a word:
interpretation semantics:
parse execute
run execute
compilation semantics:
parse execute
store execute
run compile,
postponing semantics:
parse execute
store execute
store compile,
run postpone literal postpone compile,
This idea has its charms, but I have not implemented it. It requires
additional code, benefits only parsing words, which are not that
common, and hopefully will stay so.
- 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.forth200x.org/forth200x.html
EuroForth 2008:
http://www.complang.tuwien.ac.at/anton/euroforth/ef08.html


|