Amb Tracker

XT -- A Bundle of Program Transformation Tools

Name

ambtracker -- display the productions in a parse tree causing ambiguities

Description

Compared to visamb ambtracker offers an alternative visualization of ambiguities in a parse tree. ambtracker just displays the productions causing the ambiguity and not how these productions are applied to the actual input. The location (row and column) in the input where an ambiguity is caused is also displayed for easy reference.

Consider the syntax definition that is used to illustrate visamb.

  definition
  module Main
  exports
    sorts Exp
    lexical syntax
      [\ \t\n] -> LAYOUT
    context-free syntax
      "id"    -> Exp
      Exp Exp -> Exp

From this syntax definition an SGLR parse table can be generated:

  sdf2table -i Exp.sdf -o Exp.tbl

The ambiguities of the phrase id id id can be shown with:

  echo "id id id" | sglr -2 -p Exp.tbl | ambtracker

the output of this command is:

  1 ambiguity cluster:

  [1/1] at (1:0):
    Exp  Exp -> Exp
    Exp  Exp -> Exp