Tcl Library Source Code

View Ticket
Login
Ticket UUID: eb8c1e69ba76594f03b296d4dcf9ffc52b4f2521
Title: Add "prune" mode
Type: RFE Version:
Submitter: anonymous Created on: 2017-08-22 08:36:04
Subsystem: pt (parsetools) Assigned To: aku
Priority: 3 Low Severity: Minor
Status: Open Last Modified: 2017-08-31 21:56:54
Resolution: None Closed By: nobody
    Closed on:
Description:
In addition to "value", "void" and "leaf", I'd like to have "prune": if a non terminal is empty or contains a single non terminal, then it is removed from the resulting AST, only the right side is kept (if non empty).
User Comments: aku added on 2017-08-31 21:56:54:
Ok. So this is about eliminating symbol chains.

Do you have a patch implementing this feature ?
(preferably with tests ?)

This looks to be quite a lot of work to be done from meta grammar to interpreter and the various coded engines. Especially for something which can be implemented as a post-parse tree-transformation.

anonymous added on 2017-08-29 08:47:50:
The functionality comes from waxeye:
https://waxeye.org/manual.html#_pruning_non_terminals

aku added on 2017-08-28 19:14:33:
Do you have ASCII art showing how the AST looks before vs after the use of prune ?