From: Matthew D Moss Date: 2006-01-07T17:08:31+09:00 Subject: Re: Dice Roller (#61) I'm not sure whether this made it to the list first time I sent it, or is just delayed. Here it is again in case folks missed it... > 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 = /[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 this BNF shows one way to handle the precedence/association rules.