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

Revision: r1.2 - 25 Feb 2004 - 13:22 - NielsJanssen
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback