title: Ply : problem while defining rules for the "c" language
body: <p>I'm trying to write a parser for the c language which will be able to take care of expressions, assignments, if-else and while loops.</p>
  
  <p>here are my rules :</p>
  
  <p>expression -> expression op expression<br>
  expression -> ID<br>
  expression -> NUMBER<br>
  statement -> ID ASSIGN expression<br>
  statement -> IF expression THEN statement<br>
  statement -> WHILE expression THEN statement  </p>
  
  <p>Everything in caps is a token(terminal symbol)</p>
  
  <p>When parsing the string "while h&lt;=0 then t=1", it seems to consider "h" as an expression (using the rule expression->ID). So, the expression in "WHILE expression THEN statement" becomes "h". Obviously, I would want it to consider "h&lt;=0" as the expression (using the rules expression -> expression op expression). How do I make sure that this happens?</p>