Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Compiler Tools Pccts > Resolving an am...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 65 of 134
Post > Topic >>

Resolving an ambiguity

by Doru-Catalin Togea <doru-cat@[EMAIL PROTECTED] > Sep 2, 2004 at 03:44 PM

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.               >>
        <<<< ================================== >>>>
 




 1 Posts in Topic:
Resolving an ambiguity
Doru-Catalin Togea <do  2004-09-02 15:44:52 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 20:06:51 CDT 2008.