From: Matthew Moss Date: 2006-01-07T05:37:13+09:00 Subject: Re: [QUIZ] Dice Roller (#61) ------=_Part_10155_29622363.1136575984791 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > I would appreciate the full BNF, please. Okay, this is what I've done in my current version that takes care of basic precedence and associativity. INTEGER =3D /[1-9][0-9]*/ expr: fact | expr '+' fact | expr '-' fact fact: term | fact '*' term | fact '/' term term: unit | [term] 'd' dice dice: '%' | unit unit: '(' expr ')' | INTEGER Actually, this is slightly different than my current version, which after reexamining to extract this BNF, I found a minor error (in handling of the term rules and handling of the optional arg). My own code has a morphed version of this BNF in order to code up a recursive descent parser, but thi= s BNF shows one way to handle the precedence/association rules. ------=_Part_10155_29622363.1136575984791--