-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
I very much like Owl but there's a single feature I miss. In Lark python parsing library there's a neat ? operator which replaces a node in resulting tree with its child if there's only one.
So for example a parser with the following grammar (using ? as in Lark)
program = stmt*
stmt =
'print' expr : print
?expr =
[ '(' expr ')' ] : parens
identifier : variable
number : literal
.operators prefix
'-' : negative
.operators infix left
'+' : plus
'-' : minus
would produce
program (0 - 7)
stmt : PRINT (0 - 7)
number - 1.000000 (6 - 7)
instead of
program (0 - 7)
stmt : PRINT (0 - 7)
expr : LITERAL (6 - 7)
number - 1.000000 (6 - 7)
Is such feature possible in the future or is it out of scope of the project?
Metadata
Metadata
Assignees
Labels
No labels