Skip to main content

Ambiguity Diagnosis

rascal-0.40.17

Synopsis

Ambiguity diagnosis suggests changes to syntax definitions to make them non-ambiguous.

Description

The Ambiguity library, a.k.a. DrAmbiguity, contains a diagnosis tool that can help you find the causes of ambiguous parse trees and possible Disambiguations to solve them in a Syntax Definition. DrAmbiguity is a library that processes any parse forest produced by a parser generated from Rascal's Syntax Definitions. Please read Disambiguation first.

Examples

import analysis::grammars::Ambiguity;
diagnose(t); // for any t of which you know it contains an ambiguity

Benefits

Pitfalls

  • DrAmbiguity does not scale to large parse trees, so please first make your example smaller.
  • DrAmbiguity proposes several Disambiguations for each ambiguity, only few of which make sense from a language design point of view!
  • DrAmbiguity is now only a library function, while it should be integrated into the Rascal IDE