parglare
parglare copied to clipboard
Move action definition to prod/rule meta-data
Current syntax for defining actions is:
@action_name
Rulename: ...;
If action definition would be moved to {}
block together with disambiguation and other meta-data (issue #57) a fine-grained control would be possible. As {}
block is defined by production, each production could have a different action. This would make current list-based specification of actions deprecated.
After #17 is implemented additional flexibility is achieved. Action could be given per rule as it is now, and overriden per production.
Syntax might be similar to what it's now but the @...
would be given inside {}
block.
Rulename: .... {@action_name};
Or for each production defined in one rule (after #17 is implemented):
Rulename {@action_name}: ...;
Just a note on side-actions (#51, #56 ). There could be an additional syntax to specify one or more side effect actions, i.e. actions that are called on reduction even in the context of tree building but are not expected to produce any result. Their result would be a side-effect.
An example syntax:
Rulename: .... {@action_name, ^side_action1, ^side_action2};
action_name
is a regular action while side_action1
and side_action2
are side-effect actions.
In addition, side actions could be registered similar to actions using dict passed as parser param.