Advertisement
Azure

EBNF notation for dice roller

Jul 11th, 2012
3,229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BNF 0.63 KB | None | 0 0
  1. attack roll = [multiply roll result], [digits], 'd', numeral ;
  2. roll notation = attack roll, {[operator, ( attack roll | digits )]}, [negate high or low roll], [white space, all characters] ;
  3.  
  4. digits = '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;
  5. (* Note: By using regular expressions, digits can be expressed by / \d+ /. *) ;
  6. multiply roll result = digits, '#' ;
  7. negate high or low roll = '-H' | '-L';
  8. operator = ':+'
  9.          | ':-'
  10.          | ':/'
  11.          | ':*' ;
  12. white space = ? white space characters ? ;
  13. all characters = ? all visible characters ? ;
  14.  
  15. (* Syntax example: 2#3d6+d6/2+3*4-L Attack this! *) ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement