Warning, /rolisteam/rolisteam-diceparser/README.md is written in an unsupported language. File is not indexed.

0001 [![Logo](https://raw.githubusercontent.com/Rolisteam/rolisteam/master/resources/logo/1000-rolisteam.png)](http://www.rolisteam.org)
0002 
0003 # DiceParser
0004 
0005 Rolisteam Dice Parser run dice commands. It is available on several platforms.
0006 The syntax is simple and powerful.
0007 
0008 [Full documentation here](https://invent.kde.org/rolisteam/rolisteam-diceparser/-/blob/master/HelpMe.md)
0009 
0010 
0011 ## [Invite to Your Discord Server](https://discordapp.com/oauth2/authorize?&client_id=279722369260453888&scope=bot&permissions=0)
0012 
0013 [![Discord Bots](https://discordbots.org/api/widget/279722369260453888.svg)](https://discordbots.org/bot/279722369260453888)
0014 
0015 
0016 ## Features
0017 
0018 * `99.9%` uptime
0019 * Roll any kind of dice
0020 * Customizable prefix
0021 * Custom alias/macro to improve game experience
0022 * Manage colorized dice
0023 * Many operators
0024 
0025 ## Examples:
0026 
0027 ### 3D100
0028 Roll 3 dice with 100 faces
0029 
0030 ### 10D10e[=10]s
0031 Roll 10 dice with 10 faces, 10 explodes, and sort the result.
0032 
0033 ### 100291D66666666s
0034 roll 100291 dice with 66666666666 faces and sort result
0035 
0036 ### 15D10c[>7]
0037 roll 15 dice with 10 faces and it counts number of dice which are above 7
0038 
0039 ### 1D8+2D6+7
0040 roll 1 die with 8 faces and add the result to 2 dice with 6 faces and add 7.
0041 
0042 ### D25
0043 roll 1 die with 25 faces
0044 
0045 ### 88-1D20
0046 88 minus the value of 1 die of 20 faces
0047 
0048 ### 8+8+8
0049 compute: 24
0050 
0051 ### 100/28*3
0052 compute: 100/28 = 3
0053 3*3 = 9
0054 
0055 
0056 More examples at : https://invent.kde.org/rolisteam/rolisteam-diceparser/-/blob/master/HelpMe.md
0057 
0058 ## Grammar
0059 The grammar is something like this:
0060 
0061 ```
0062 Program =: Instruction [InstructionSeparator, Instruction]* Comment
0063 InstructionSeparator = ;
0064 Instruction =: Expression ([Operator, Expression]* | [Option]*)
0065 Operator =: ScalarOperator
0066 Expression =: OpenParenthesis Expression closeParenthesis
0067 | Option*
0068 | [Operator, Expression]*
0069 | Operand Dice
0070 | Command
0071 | function
0072 | NodeOperator [Option]*
0073 | ValuesList
0074 | Dice (Operand == 1)
0075 Operand =: DynamicVariable | Number | String
0076 OpenParenthesis = (
0077 closeParenthesis = )
0078 OpenList = [
0079 CloseList = ]
0080 ListSeparator = ,
0081 ValuesList=: OpenList (DynamicVariable | Number)? [ ListSeparator,(DynamicVariable | Number)]*  CloseList
0082 Dice =: DiceOperator [uniqueValue] DiceParameter
0083 DiceOperator =: D ParameterDice | L ParameterList
0084 DiceParameter =: ParameterDice | ParameterList
0085 ParameterDice =: Number|Range
0086 ParameterList =: List
0087 List=: OpenList String[Probability] [ListSeparator,String[Probability]]* CloseList
0088 Probability=: OpenList (Range|Percentage) CloseList
0089 Percentage =: number
0090 function =: functionName OpenParenthesis [function_args] closeParenthesis
0091 function_args =: Instruction [InstructionSeparator, Instruction] | Operand | ValidatorList
0092 functionName =: repeat
0093 Option =: Keep
0094 | KeepAndExplode
0095 | Filter
0096 | Sort
0097 | Count
0098 | Reroll
0099 | RerollUntil
0100 | RerollAndAdd
0101 | Explode
0102 | Merge
0103 | Bind
0104 | Occurences
0105 | Unique
0106 | Paint
0107 | If
0108 | Split
0109 | Group
0110 Range =: OpenList Number RangeSeparator Number CloseList
0111 RangeSeparator =: ..
0112 ScalarOperator =: [x,-,*,x,/,**]
0113 number =: [-] [0-9]+ | constantValue
0114 OpenVaribale=: ${
0115 CloseVariable=: }
0116 constantValue =: OpenVaribale (id | label) CloseVariable
0117 id=[_,a-z][_,A-z,0-9]* # must respect rules of QML id
0118 label=.*
0119 variable = OpenVaribale [0-9]+ CloseVariable
0120 ValidatorList =: OpenList CompareMethod Validator [LogicOpetator CompareMethod Validator]* CloseList
0121 LogicOpetator =: AND | XOR |  OR
0122 CompareMethod =: Each |  All | Scalar | ANY
0123 Each=:
0124 All=: *
0125 Scalar=: :
0126 ANY=: .
0127 AND =: &
0128 XOR =: ^
0129 OR =: |
0130 Ascendant=:l
0131 Validator =: BooleanValidator | RangeValidator | OperationValidator
0132 CompareOpetator =: = | > | >= | < | <= | !=
0133 RangeValidator =: Range
0134 OperationValidator =: Modulo operandNode BooleanValidator
0135 Modulo =: %
0136 BooleanValidator =: [=]Operand | [CompareOpetator Operand]
0137 ListOfValue=: String[Range],ListOfValue | String[Range]
0138 String =: .*[^ListSeparator]
0139 Keep =: k[Ascendant] Number
0140 KeepAndExplode =: K[Ascendant] number
0141 Filter =: f ValidatorList
0142 Sort =: s[Ascendant]
0143 Count =: c ValidatorList
0144 Reroll =: r ValidatorList
0145 RerollUntil =: R ValidatorList
0146 RerollAndAdd =: a ValidatorList
0147 Merge =: m
0148 Bind =: b
0149 Occurences =: OccurencesWidth ( ListSeparator  number | ValidatorList)
0150 OccurencesWidth =: number
0151 unique =: u
0152 Painter =: p PainterParameters
0153 PainterParameters =: OpenList PairColorOccurence [ListSeparator , PairColorOccurence]* CloseList
0154 PairColorOccurence =: Color PairSeparator Number
0155 PairSeparator =: :
0156 If =: i [compareMethod] ValidatorList Bloc[Bloc]
0157 compareMethod =: OnEach | OneOfThem | AllOfThem | onScalar
0158 OnEach =: ''
0159 OneOfThem = '.'
0160 AllOfThem = '*'
0161 onScalar = ':'
0162 Bloc =: OpenBranch Expression CloseBranch
0163 OpenBloc =: {
0164 CloseBloc =: }
0165 Split =: y
0166 Group =: g Number
0167 Sort =: s
0168 Group =: number
0169 Explode =: e ValidatorList
0170 NodeOperator = Jumpbackward
0171 Jumpbackward =: @
0172 Merge =: m | m Expression
0173 Command =: help | la
0174 uniqueValue = u
0175 Comment =: StartComment String
0176 StartComment =: #
0177 ```
0178 
0179 
0180 # Compilation
0181 
0182 ```
0183 git clone --recursive https://invent.kde.org/rolisteam/rolisteam-diceparser.git
0184 cd rolisteam-diceparser
0185 mkdir build
0186 cd build
0187 cmake ../ -DBUILD_CLI=ON
0188 make
0189 sudo make install
0190 ```