Since a long time (meta compilers for the 8051 while ISO was
new) the Dutch community has a word WINTERPRET that sees
it use mainly for meta compilers.
This word interprets a string constant, and thus INTERPRET
is a loop over this word. Naturally it terminates on
a string with length zero.
( NAME would be something like `` BL WORD COUNT '' )
: INTERPRET
BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;
WINTERPRET comes in handy for my lisp efforts too, 1]
but I'm inclined to name it INTERPRET-TOKEN.
1. Are others using this factor of INTERPRET ?
2. Is the name WINTERPRET common ?
3. Is this known under another name?
As far as 2 is concerned I expect not. WINTERPRET is a
Dutch word and its meaning is `` winter fun ''.
This cuteness is not a good base for a name, and I can't
relate it to any naming convention in Forth, prefixing a single
character.
1]
In lisp a ' is supposed to parse another token and transform it like so: '<item> --> (quote <item> )
Such words can be generated by a defining word:
: define-quote CREATE $, DROP PREFIX DOES>
empty() SWAP $@ symbol-append interpret-token build-list
vector-append ; PREFIX
Example:
"quote" define-quote '
and
"deref" define-quote @
Note that <item> can be a list `` (+ 1 2) '' that is parsed by
the prefix `` ( '' or any type that is determined by the
first character: 1 " ( [ a b .. z
Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the hide of the bear until you shot it. Better one bird in the hand than ten in the air. First gain is a cat spinning. - the Wise from Antrim -
On Sunday, 8 October 2023 at 19:18:51 UTC+1, none albert wrote:
Since a long time (meta compilers for the 8051 while ISO was
new) the Dutch community has a word WINTERPRET that sees
it use mainly for meta compilers.
This word interprets a string constant, and thus INTERPRET
is a loop over this word. Naturally it terminates on
a string with length zero.
( NAME would be something like `` BL WORD COUNT '' )
: INTERPRET
BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;
WINTERPRET comes in handy for my lisp efforts too, 1]
but I'm inclined to name it INTERPRET-TOKEN.
1. Are others using this factor of INTERPRET ?
2. Is the name WINTERPRET common ?
3. Is this known under another name?
As far as 2 is concerned I expect not. WINTERPRET is a
Dutch word and its meaning is `` winter fun ''.
This cuteness is not a good base for a name, and I can't
relate it to any naming convention in Forth, prefixing a single
character.
1]
In lisp a ' is supposed to parse another token and transform it like so:
'<item> --> (quote <item> )
Such words can be generated by a defining word:
: define-quote CREATE $, DROP PREFIX DOES>
empty() SWAP $@ symbol-append interpret-token build-list
vector-append ; PREFIX
Example:
"quote" define-quote '
and
"deref" define-quote @
Note that <item> can be a list `` (+ 1 2) '' that is parsed by
the prefix `` ( '' or any type that is determined by the
first character: 1 " ( [ a b .. z
Groetjes Albert
What you have named interpret I just called repl() and so interpret is
free to be
used as as interpret()
Any reason why you didnt just call it eval ( or a variation of )?
Since a long time (meta compilers for the 8051 while ISO was
new) the Dutch community has a word WINTERPRET that sees
it use mainly for meta compilers.
This word interprets a string constant, and thus INTERPRET
is a loop over this word. Naturally it terminates on
a string with length zero.
( NAME would be something like `` BL WORD COUNT '' )
: INTERPRET
BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;
WINTERPRET comes in handy for my lisp efforts too, 1]
but I'm inclined to name it INTERPRET-TOKEN.
1. Are others using this factor of INTERPRET ?
2. Is the name WINTERPRET common ?
3. Is this known under another name?
On 2023-10-08 18:18, albert wrote:
Since a long time (meta compilers for the 8051 while ISO was
new) the Dutch community has a word WINTERPRET that sees
it use mainly for meta compilers.
This word interprets a string constant, and thus INTERPRET
is a loop over this word. Naturally it terminates on
a string with length zero.
( NAME would be something like `` BL WORD COUNT '' )
: INTERPRET
BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;
WINTERPRET comes in handy for my lisp efforts too, 1]
but I'm inclined to name it INTERPRET-TOKEN.
1. Are others using this factor of INTERPRET ?
2. Is the name WINTERPRET common ?
3. Is this known under another name?
In SP-Forth/4 there is a similar word:
EVAL-WORD ( i*x sd.name -- j*x )
It translates only a word name (it throws an exception if the word is
not found). So, it cannot be used in the Forth text interpreter loop.
I use the word TRANSLATE-LEXEME ( i*x sd.lexeme -- j*x )
that translates any lexeme according to the current state.
To translate a lexeme: to recognize a lexeme and perform the compilation >semantics for it if the Forth text interpreter is in compilation state,
or the interpretation semantics if in interpretation state.
The name "INTERPRET-TOKEN" is confusing, since:
1. It can mean both performing interpretation semantics regardless of
the state, and translating (according to the above term definition).
2. "Token" can mean execution token, name token, or other similar thing,
or "lexical token" (which is a pair of a lexeme and *its kind*). And
what this word actually implies is not from this list.
--
Ruvim
In article <ugdmdp$3pgl5$1@dont-email.me>,
Ruvim <ruvim.pinka@gmail.com> wrote:
On 2023-10-08 18:18, albert wrote:
Since a long time (meta compilers for the 8051 while ISO was
new) the Dutch community has a word WINTERPRET that sees
it use mainly for meta compilers.
This word interprets a string constant, and thus INTERPRET
is a loop over this word. Naturally it terminates on
a string with length zero.
( NAME would be something like `` BL WORD COUNT '' )
: INTERPRET
BEGIN NAME DUP WHILE WINTERPRET ?STACK REPEAT 2DROP ;
WINTERPRET comes in handy for my lisp efforts too, 1]
but I'm inclined to name it INTERPRET-TOKEN.
1. Are others using this factor of INTERPRET ?
2. Is the name WINTERPRET common ?
3. Is this known under another name?
In SP-Forth/4 there is a similar word:
EVAL-WORD ( i*x sd.name -- j*x )
It translates only a word name (it throws an exception if the word is
not found). So, it cannot be used in the Forth text interpreter loop.
I don't follow the logic. It is not true for at least one implementation model. I can factor out INTERPRET-TOKEN out of INTERPRET in ciforth. INTERPRET-TOKEN throws exceptions all the time.
I use the word TRANSLATE-LEXEME ( i*x sd.lexeme -- j*x )
that translates any lexeme according to the current state.
As English dictionaries go:
INTERPRET is approximately the same TRANSLATE
TOKEN is approximately the same as LEXEME
So we are not far apart.
So we have
WINTERPRET
INTERPRET-TOKEN
EVAL-WORD
TRANSLATE-LEXEME
The conclusion is that it is a solid concept, reinvented many times,
and that it is deserving of a definitive name.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 300 |
Nodes: | 16 (3 / 13) |
Uptime: | 50:24:47 |
Calls: | 6,712 |
Calls today: | 5 |
Files: | 12,243 |
Messages: | 5,354,927 |
Posted today: | 1 |