You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recognizer v4 API suggests to use the prefix rec- for names of recognizers. E.g. rec-num or rec-nt.
A disadvantage is that it's a truncated English word, and it appears as a noun at the first glance — due to association to "record" or "recognizer". And also due to "rectype" term that is noun. But by convention, it should be a verb for such a Forth word (or an abbreviation to a verb at least).
I would suggest to use the complete English word and the prefix recognize- for such words. E.g. recognize-nt.
Concerning the second part, it's better if it is either a complete English noun, or an appropriate data type symbol from the standard types.
E.g. recognize-number, recognize-double, recognize-float, recognize-xt, recognize-word.
If we need to recognize the different lexeme formats for the same token, we can use the third part. E.g. recognize-float-e to recognize a float from a literal representation (lexeme) contains e symbol only, recognize-double-dot to recognize double-cell number from a literal that has a trailing dot only, etc.
recognize-word can be a compound recognizer that can return ( xt td-xt ), or ( xt td-xt-imm ), or ( xt1 xt2 td-xt-dual ) or ( nt td-nt ).
The text was updated successfully, but these errors were encountered:
ruv
added
api
An API method semantics consideration
v4-review
Related to the proposal v4 by Matthias Trute
naming
Choosing names, the art
labels
Sep 8, 2020
If a recognizer is just a kind of transformation for the perceptor, a better name is perceive-{something}. E.g.
: perceive-xt ( c-addr u -- xt td-xt | 0 )
'perceive execute-balance2 2>r token>xt? 2r>
2 pick if 2drop exit then nfdrop 3 + ndrop 0
;
This recognizer recognizes the only lexemes which are recognized by the perceptor as ordinary words.
Such recognizer cannot be included into the perceptor directly (due to unlimited recursion). It can be only used in another recognizers to be applied to the different lexeme. And the different name pattern also indicates this different semantics.
Recognizer v4 API suggests to use the prefix
rec-
for names of recognizers. E.g.rec-num
orrec-nt
.A disadvantage is that it's a truncated English word, and it appears as a noun at the first glance — due to association to "record" or "recognizer". And also due to "rectype" term that is noun. But by convention, it should be a verb for such a Forth word (or an abbreviation to a verb at least).
I would suggest to use the complete English word and the prefix
recognize-
for such words. E.g.recognize-nt
.Concerning the second part, it's better if it is either a complete English noun, or an appropriate data type symbol from the standard types.
E.g.
recognize-number
,recognize-double
,recognize-float
,recognize-xt
,recognize-word
.If we need to recognize the different lexeme formats for the same token, we can use the third part. E.g.
recognize-float-e
to recognize a float from a literal representation (lexeme) containse
symbol only,recognize-double-dot
to recognize double-cell number from a literal that has a trailing dot only, etc.recognize-word
can be a compound recognizer that can return( xt td-xt )
, or( xt td-xt-imm )
, or( xt1 xt2 td-xt-dual )
or( nt td-nt )
.The text was updated successfully, but these errors were encountered: