Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-21953

Why is this PARSE Grammar ambiguous?

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Resolved
    • Priority: Not specified
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Language
    • Labels:
      None

      Description

      Hi.

      To get my head around the Tomita variant of parsing.
      I've generated the very simplest grammar, (where there are lots of examples on the Web).
      Just to parse palindromes. So I have:

      TOKEN a := 'a';
      TOKEN b := 'b';
      
      attrRec := RECORD
      STRING  val;
      END;
      
      RULE(attrRec) expr := a  USE(attrRec,expr) a 
                          | b  USE(attrRec,expr) b 
                          | (a|b) TRANSFORM(attrRec,SELF.val := $1 );
      
      infile := DATASET([{'aba'},{'a'},{'b'},{'ab'}],{ STRING line });
      
      OUTPUT(PARSE(infile,line,expr,{STRING Text := MATCHTEXT},FIRST,WHOLE,PARSE,SKIP([' ','\t']+)));
      

      This all works, but I get this warning:

      Warning:  The PARSE pattern for activity 3 is ambiguous.  This may reduce the efficiency of the PARSE. (15, 8), 4537,
      

      And I can't for the life of me work out why.

      Initially, I placed this as a question on the Forum but got no replies. 

      So I've had to resort to the core team.

      Yours

      Allan 

       

       

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              allan Allan Francis Wrobel
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: