auparse_node_compare - Linux


Overview

auparse_node_compare compares nodes in two AU parse trees and prints a summary of differences. It is useful for debugging and testing AU parsers.

Syntax

auparse_node_compare [-h] [-s STR] [-r] [-d]
                      au_parse_tree1 au_parse_tree2

Options/Flags

  • -h, –help: Show help message and exit.
  • -s STR, –score STR: Print score (0-100) indicating similarity of trees.
  • -r, –root: Compare subtrees rooted at first nodes in trees rather than entire trees.
  • -d, –disable-reorder: Disable node reordering for comparison.

Examples

  • Compare entire trees:
auparse_node_compare tree1.au tree2.au
  • Compare subtrees:
auparse_node_compare -r tree1.au tree2.au
  • Print similarity score:
auparse_node_compare -s tree1.au tree2.au

Common Issues

  • Nodes with different order: If nodes are not in the same order in both trees, the comparison may fail. Use the -d flag to disable node reordering for more lenient comparison.
  • Different node types: If nodes are of different types (e.g., branch vs. leaf), the comparison will fail. Ensure trees are well-formed before comparison.

Integration

auparse_node_compare can be integrated into scripts or pipelines for automated testing or debugging.

Related Commands

  • auparse: Parses AU language expressions into parse trees.
  • auparse_print: Prints AU parse trees in a readable format.