Nadaka's DiceBox (Web Service Version III)

Information

Welcome to the third incarnation of Nadaka's DiceBox.

New Features:

Legacy Features:

Comming soon:

Technology

This site uses asp.net web services to allow other site owners to subscribe to this service and use it in thier own web sites. This web service delivers its results via either xml or json objects. If you wish to use this webservice in conjunction with comments and group membership, you must register to recieve a personal access code. This code and the account associated with it can be banned for inapropriate use. Inapropriate use is currently defined as using this service for spam or illegal activities and uploading or linking to pornography, executable scripts or programs, browser exploits and malicious web sites.

Dice Expression Grammar:

  1. Tokens: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | + | - | d | ( | ) | , | * | x
  2. List
    -> Sum List2
  3. List2
    -> , Sum List3 | * Sum List3 | ϵ
  4. List3
    -> , Sum List2 | ϵ
  5. Sum
    -> Dice Sum2
  6. Sum2
    -> + Dice | - Dice | ϵ
  7. Dice
    -> Number Dice2
  8. Dice2 -> d Number Dice2 | x Number Dice2 | ϵ
  9. Number -> Digit MoreDigits | ( Sum )
  10. MoreDigits -> Digit MoreDigits | ϵ
  11. Digit -> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

DiceBoxWS uses a predictive recursive descent parser with left to right greedy evaluation. Its tokenizer is a simple lexical analyser that generates tokens from the input stream while ignoring whitespace. These tokens are fed through the parser, evaluated for gramatic correctness and built into a parse tree. If the parser has completed without error, the parse tree then processes the instructions for each token node and accumulates the results.

The original productions listed below suffered from left recursion and ambiguity. After optimization both issues are resolved as well as the opportunity to take advantage of tail recursion to looping optimization.
  1. List -> List , Sum | Sum * Sum | Sum , List
  2. Sum -> Sum + Dice | Sum - Dice | Dice
  3. Dice -> Dice d Value | Dice x Value | Value

Symbol Meanings:

'd': generate a random number between 1 and the right arguement a number of times equal to the left arguement and return a value equal to the sum. This is analogous to rolling a number of same sided dice and returning the sum.
'x': as d, except that if an individual random number is equal to the right arguement, add it and generate again. This is analogous to "exploding" dice.
'+'|'-': as math.
'*': repeats the right expression a number of times equal to the left expression and returns a list of the values. This is a shorthand method of generating large lists of values.
',': list seperator.
'('|')': override order of operations. Currently this can not contain the list symbols: '*' and ','.
Valid XHTML 1.0 Transitional! Valid CSS 2.1!
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, and the rest of this website copyright 2003 to 2010 by Paul "Nadaka"/"Spork" Giegler.