Closed woutersl closed 8 years ago
Original comment by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).
Verified
Original comment by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).
[fix] Fixing issue #34 in .Net runtime
Original comment by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).
[fix] Fixed issue #34 in the Java runtime
Original report by Laurent Wouters (Bitbucket: 557058:675792b6-d731-4823-9f7d-c6dfcb2df2b5, ).
The RNGLR algorithm use a Shared-Packed Parse Forest (SPPF) construction for the AST. When promote actions are applied on a rule that cause ambiguities, the SPPF builder sometimes reuse nodes on which promote actions have already been applied, thus mis-constructing the AST.
To reproduce: Grammar:
grammar Test { options {Axiom="s";} terminals { X->'x'; A->'a'; B->'b'; } rules { s->A^ s (B! s)?; s->X^; } }
Compile with RNGLR
Sample input: "axbx"
Expected AST: A ( X X )
Mis-constructed AST: A ( X X X ) The first two Xs are in fact the same AST node.