Parse a dice notation string into an AST.
The dice notation to parse
The root AST node
If the input contains invalid characters
If the input has invalid syntax
const ast = parse('2d6+3');// { type: 'BinaryOp', operator: '+',// left: { type: 'Dice', count: 2, sides: 6 },// right: { type: 'Literal', value: 3 } } Copy
const ast = parse('2d6+3');// { type: 'BinaryOp', operator: '+',// left: { type: 'Dice', count: 2, sides: 6 },// right: { type: 'Literal', value: 3 } }
Parse a dice notation string into an AST.