Handling Grammar Cycles in the 1997 SML Definition

Research output: Chapter in Book/Report/Conference proceedingConference contribution

7 Downloads (Pure)

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.
Original languageEnglish
Title of host publicationProceedings of the 18th ACM SIGPLAN International Conference on Software Language Engineering (SLE '25), June 12--13, 2025, Koblenz, Germany
PublisherACM
Pages3-15
Number of pages13
DOIs
Publication statusPublished - 17 Jun 2025

Cite this