From: Emanuel Pessoa <emanuelpessoa@gm...>  20051126 21:30:41

hi guys, despite the help, i'm still having problems in adding a propability to ever= y condition in my conditional structures in the code. to eliminate amibiguities, we defined that every conditional in the grammar has an obligatory associated probability. so, the conditional would be like: x > 5 prob 70 s < 30 prob 65 a =3D=3D b prob 55 c =3D=3D func (b) prob 20 c !=3D 4 prob 98 so, every conditional expression in a condicional structure [while, if...] would take the form: while (x > 5 prob 70 && s < 30 prob 65) the evaluation of the sentence is the same as in standard C, but i have to pass the probability value to AST, in a way to put it in the generated Assembly code. Sentences like while (x > 5) lead us to error; the correct sentence must have a associated probability, like shown before. we performed a change to the SDCC.lex file to recognize the prob token "prob" { count(); return(PROB); } or it would be "prob" { count(); TKEYWORDSDCC(PROB); }??? in the SDCC.y we defined a new nonterminal named propab Probab : PROB CONSTANT {$$ =3D (int) floatFromVal($2); } ; and rewrite the relations and equalities expressions to: relational_expr : shift_expr  relational_expr '<' shift_expr Probab{ $$ =3D (port>lt_nge ? newNode('!',newNode(GE_OP,$1,$3),NULL) : newNode('<', $1,$3)); }  relational_expr '>' shift_expr Probab{ $$ =3D (port>gt_nle ? newNode('!',newNode(LE_OP,$1,$3),NULL) : newNode('>',$1,$3)); }  relational_expr LE_OP shift_expr Probab{ $$ =3D (port>le_ngt ? newNode('!', newNode('>', $1 , $3 ), NULL) : newNode(LE_OP,$1,$3)); }  relational_expr GE_OP shift_expr Probab{ $$ =3D (port>ge_nlt ? newNode('!', newNode('<', $1 , $3 ), NULL) : newNode(GE_OP,$1,$3)); } ; equality_expr : relational_expr  equality_expr EQ_OP relational_expr Probab{ $$ =3D (port>eq_nne ? newNode('!',newNode(NE_OP,$1,$3),NULL) : newNode(EQ_OP,$1,$3)); }  equality_expr NE_OP relational_expr Probab{ $$ =3D (port>ne_neq ? newNode('!', newNode(EQ_OP,$1,$3), NULL) : newNode(NE_OP,$1,$3)); } ; But unfortunately our changes lead us to errors and we wonder ourselves if we are changing the files in a right way and/or changing the right files. What is the best way to keep the probabilities values in the AST? Will it b= e necessary to add a node to every sentence or just to the ones that needs to preserve that value? Great Thanks Emanuel Pessoa 