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

Parse Events: adverbs + handlers? #32

Open
rns opened this issue May 14, 2015 · 1 comment
Open

Parse Events: adverbs + handlers? #32

rns opened this issue May 14, 2015 · 1 comment
Labels

Comments

@rns
Copy link
Owner

rns commented May 14, 2015

LUIF manual currently specifies completion and prediction events via completed and predicted adverbs.

Their values are event handler functions, which can call context accessors to get location data and rule data.

Below is an idea on how to use that approach for other event types defined for Marpa::R2.

Nulling events can be set by modifying a nulling rule with nulled adverb.

Pre- and post-lexeme events can be set using predicted and completed adverbs of a lexeme rule (having action = lexeme or lexeme = true adverb). Their handlers will be able to use luif.recognizer.lexeme_read() to read lexemes and context accessors in luif.context.*.

Discard events can be set via discarded adverb on a lexeme rule.

discard = true on a lexeme rule will discard a lexeme,
on a structural rule it will be a synonym for hiding ([]).

Exhaustion and rejection event handlers can be set in luif.recognizer.new(),
and, if so set, will be synonymos to rejection = event in Marpa::R2.

All events are off (deactivated) by default that can be changed by luif.event.activate(rule_id, event_name) and luif.event.deactivate(rule_id, event_name), where event_name is the same as the adverb name. Alternatively, activate = on/off can be used in conjunction with the event handler adverbs.

@rns rns added the idea label May 14, 2015
@jeffreykegler
Copy link
Collaborator

Sounds basically good.

Note the distinction between nulling rules, which always derive the
zero-length string, and nullable rules, which may derive the zero-length
string. I think you say one in the above when you mean the other.

The idea of making hiding analogous to discarding is nice.

The event-adverb for discard needs another name, I think -- the name is
analogous to other event names, but otherwise unsuggestive. Perhaps an
event adverb, which is a discarded event for a discarded lexeme, a
post-lexeme event for other lexemes and a completion event for structural
rules.

Multiple event adverbs may occur with the same rule, so an activate
adverb would be ambiguous.

On Thu, May 14, 2015 at 3:39 AM, rns notifications@github.com wrote:

LUIF manual currently specifies completion and prediction events via
completed and predicted adverbs.

Their values are event handler functions, which can call context accessors
https://github.com/rns/kollos-luif-doc/blob/master/manual.md#context_accessors
to get location data and rule data.

Below is an idea on how to use that approach for other event types defined
for Marpa::R2
https://metacpan.org/pod/distribution/Marpa-R2/pod/Event.pod.

Nulling events can be set by modifying a nulling rule with nulled adverb.

Pre- and post-lexeme events can be set using predicted and completed
adverbs of a lexeme rule (having action = lexeme or lexeme = true adverb
#31). Their handlers will
be able to use luif.recognizer.lexeme_read() to read lexemes and context
accessors in luif.context.*.

Discard events can be set via discarded adverb on a lexeme rule.

discard = true on a lexeme rule will discard a lexeme,
on a structural rule it will be a synonym for hiding ([]).

Exhaustion and rejection event handlers can be set in
luif.recognizer.new(),
and, if so set, will be synonymos to rejection = event in Marpa::R2.

All events are off (deactivated) by default that can be changed by luif.event.activate(rule_id,
event_name) and luif.event.deactivate(rule_id, event_name), where
event_name is the same as the adverb name. Alternatively, activate =
on/off can be used in conjunction with the event handler adverbs.


Reply to this email directly or view it on GitHub
#32.

@rns rns added draft and removed idea labels May 15, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants