How about a "Burry" action?

Issue #47 resolved
Goomba
created an issue

Hi, first Hime is awesome, it has very sophisticated features, so I think it's worth creating a bitbucket account to post this :)

The promotes and drop actions are great, but it would be nice to turn nodes into childs too.

something like ${ child_statement }$ where the $ symbols would define the parent node, and turn the AST into {} => child_statement.

Not sure I was clear =)

Comments (8)

  1. Laurent Wouters

    Hi, thanks for the input! I think this is an interesting proposal and would not require much change. Note that Hime already have a feature for context-sensitive lexing that uses a notation such as:

    variable -> x #context { a b c } y ;
    

    As you can see, Hime already uses the curly brackets within the body of rules to delimit a part of this body. So why not re-use this without the context specification. So this would give:

    variable -> x { a b c } y ;
    

    The produced AST would be like:

    variable( x epsilon( a b c )  y )
    

    Because we still need to put a symbol on the created sub-parent, we could use the built-in epsilon terminal. I think this can be implemented as a rather simple grammar re-rewriting because the rule would be equivalent to:

    variable -> x _gen y ;
    _gen -> epsilon^ a b c ;
    

    where _gen is a generated variable that will be replaced when parsing by the epsilon terminal with the promote action.

    Do you think this would solve your issue ?

  2. Log in to comment