Hi!
I have the following piece of a PCCTS grammar. I need to translate it to
CFG so that it can be used with one of the enemy's parser tools (PLY). But
I have an ambiguity and I do not know how to solve it:
Original:
---------------------------------------------------------
<constraint> ::= "constraint" <constraint_expr> ";"
<constraint_expr> ::= <or_expr> ("|" <or_expr>)*
<or_expr> ::= <and_expr> ("&" <and_expr>)*
<and_expr> ::= <label>
| "(" <constraint_expr> ")"
<label> ::= <identifier>
---------------------------------------------------------
CFG version (everything in capitals are terminals):
---------------------------------------------------------
constraint : CONSTRAINT constraint_expression SCOLON
constraint_expression : or_expression or_expressions
or_expressions : empty
| OR or_expression
or_expression : and_expression and_expressions
and_expressions : empty
| AND and_expression
and_expression : IDENTIFIER
LPAR constraint_expression RPAR
---------------------------------------------------------
Anyone who can help?
Thanks,
Catalin
--
<<<< ================================== >>>>
<< We are what we repeatedly do. >>
<< Excellence, therefore, is not an act >>
<< but a habit. >>
<<<< ================================== >>>>