Abstract
Fully general parsers permit the syntax specification of formal
languages to be unrestricted, allowing language designers
to use a syntax specification that supports semantics
specification, but also permitting ambiguity. Language workbenches
that support fully general grammars need tools
which can generate robust default behaviour but also allow
experienced designers to specify particular choices when ambiguity
is encountered. The standard longest match approach
to ambiguity resolution is not robust when a grammar contains
cycles. Although cycles can be removed from a grammar,
this disrupts the syntax specification. We present an
algorithm that safely removes cycles from the shared packed
parse forests generated by general parsers and explore the
application of the algorithm to the 1997 SML Definition. The
algorithm results in a sub-forest to which further designerspecified
or default disambiguation rules can be applied.
languages to be unrestricted, allowing language designers
to use a syntax specification that supports semantics
specification, but also permitting ambiguity. Language workbenches
that support fully general grammars need tools
which can generate robust default behaviour but also allow
experienced designers to specify particular choices when ambiguity
is encountered. The standard longest match approach
to ambiguity resolution is not robust when a grammar contains
cycles. Although cycles can be removed from a grammar,
this disrupts the syntax specification. We present an
algorithm that safely removes cycles from the shared packed
parse forests generated by general parsers and explore the
application of the algorithm to the 1997 SML Definition. The
algorithm results in a sub-forest to which further designerspecified
or default disambiguation rules can be applied.
Original language | English |
---|---|
Title of host publication | Proceedings of the 18th ACM SIGPLAN International Conference on Software Language Engineering (SLE '25), June 12--13, 2025, Koblenz, Germany |
Publisher | ACM |
Pages | 3-15 |
Number of pages | 13 |
DOIs | |
Publication status | Published - 17 Jun 2025 |