Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: accessors to methods vs higher level methods #6

Open
ruv opened this issue Jun 10, 2020 · 0 comments
Open

API: accessors to methods vs higher level methods #6

ruv opened this issue Jun 10, 2020 · 0 comments
Labels
api An API method semantics consideration v4-review Related to the proposal v4 by Matthias Trute

Comments

@ruv
Copy link
Collaborator

ruv commented Jun 10, 2020

Recognizer v4 API proposes to use accessors on a descriptor.

An accessor fetches from a descriptor the xt of an action that can be performed on a token. There are words like RECTYPE>COMP ( td -- xt-compiler ), RECTYPE>INT ( td -- xt-interpreter ), etc.

But it is simpler to use the words that do the corresponding actions instead using of the accessor. Some possible actions:

  • interpret-token ( i*x token{k*x} td -- j*x )
  • compile-token ( i*x token{k*x} td -- j*x )
  • translate-token ( i*x token{k*x} td -- j*x )
  • postpone-token ( token{k*x} td -- )
  • reproduce-token ( token{k*x} td -- )
  • drop-token ( token{k*x} td -- )

NB: the most of them are not demanded by programs, and so shouldn't be standardized.

Rationale

In the most cases a user/program needs just to perform the target actions. Getting an xt and then executing it has an excessive step without any profit.

E.g.

  • rectype>int execute vs interpret-token
  • rectype>comp execute vs compile-token

Perhaps an implementation of POSTPONE can be slightly better optimized if it relies on accessors. But POSTPONE is a standard word and its implementation may use the carnal knowledge. So, this reason isn't enough to standardize accessors.

NB: the run-time semantics compiled by reproduce-token can be to reproduce either the token, or the token and its descriptor, and what is better is needed to be analyzed.

In comparison with other actions, reproduce-token and drop-token are not connected to the source lexeme semantics.

@ruv ruv added api An API method semantics consideration v4-review Related to the proposal v4 by Matthias Trute labels Jun 10, 2020
@ruv ruv changed the title API: accessors vs target actions API: accessors to methods vs higher level methods Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api An API method semantics consideration v4-review Related to the proposal v4 by Matthias Trute
Projects
None yet
Development

No branches or pull requests

1 participant