I am wondering if it is possible to define a LHS action. I mean something like this:
<create table> ::=
(CREATE TABLE) identifier ('(') <table element list> (')' ';')
action => ::lhs
This should mean call the action with the name of the rule. Later on it would be possible to define a default action for all rules:
:default ::= action => ::lhs
I also thought to define it myself, but I can not find a place where I can define what gets passed to an action. I seems to me that it is always the value. If I would be able to pass also the LHS to the action, I could do the dispatching myself.
Is it possible anyhow or do I have to write the action name in every rule:
<create table> ::=
(CREATE TABLE) identifier ('(') <table element list> (')' ';')
action => create_table
The reason why I want to use the 'action' attribute instead of 'bless' is, that I want to build in one pass ready to use Perl objects. If I use the 'bless' approach, I have two passes. The first builds a bunch of blessed arrays, which define the AST and after that I have to traverse the AST to build my Perl objects. When I use the actions to define the Perl objects, I can avoid the AST creation and the second pass.