You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, I've been writing my own version of the Ada grammar (for Ada 2022). One of the major left-recursive rules is name (Ada LRM, 4.1(2/5)). The original production is:
name::=direct_name|explicit_dereference|indexed_component|slice|selected_component|attribute_reference|type_conversion|function_call|character_literal|qualified_expression|generalized_reference|generalized_indexing|target_namedirect_name ::= identifier|operator_symbolprefix ::= name|implicit_dereferenceexplicit_dereference ::= name.allimplicit_dereference ::= name
name
: direct_name
//| explicit_dereference
| name DOT ALL
| name '(' expression (',' expression)* ')' //indexed_component
| name '(' discrete_range ')' //slice
| name DOT selector_name //selected_component
| name SQ attribute_designator //attribute_reference
| type_conversion
| name actual_parameter_part //function_call
| character_literal
| qualified_expression
//| name //generalized_reference
| name actual_parameter_part //generalized_indexing
;
However, this is missing a few extra productions, so I modified this to suit my grammar:
name:
direct_name
| name FULL_STOP ALL
| name LEFT_PARENTHESIS expression (COMMA expression)* RIGHT_PARENTHESIS
| name LEFT_PARENTHESIS discrete_range RIGHT_PARENTHESIS
| name FULL_STOP selector_name
| name APOSTROPHE attribute_designator
| ((value_sequence | name) APOSTROPHE reduction_attribute_designator)
| type_conversion
| name actual_parameter_part
| CHARACTER_LITERAL
| qualified_expression
| name actual_parameter_part
| target_name
;
But Antlr still believes that this is mutually left-recursive. This rule (name) is the (only) rule that Antlr gives me when it generates Error 119. How else am I supposed to refactor this without risking breaking the syntax?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
So, I've been writing my own version of the Ada grammar (for Ada 2022). One of the major left-recursive rules is
name
(Ada LRM, 4.1(2/5)). The original production is:The Ada 2012 Grammar rewrites this as:
However, this is missing a few extra productions, so I modified this to suit my grammar:
But Antlr still believes that this is mutually left-recursive. This rule (
name
) is the (only) rule that Antlr gives me when it generates Error 119. How else am I supposed to refactor this without risking breaking the syntax?Beta Was this translation helpful? Give feedback.
All reactions