shnarazk/tree-sitter-bqn

`blMod_2_`, `blMod_1`, `BlFunc` and `blSub`

Closed this issue · 2 comments

Unresolved conflict for symbol sequence:

  '('  atom  •  '('  …

Possible interpretations:

  1:  '('  (subExpr  atom  •  Derv  '↩'  subExpr)
  2:  '('  (subExpr  atom  •  Derv  '↩')
  3:  '('  (subject  atom)  •  '('  …

Possible resolutions:

  1:  Specify a higher precedence in `subExpr` than in the other rules.
  2:  Specify a higher precedence in `subject` than in the other rules.
  3:  Specify a left or right associativity in `subject`
  4:  Add a conflict for these rules: `subject`, `subExpr`
  • development of the 1st:
  1. nothing
  2. subject, Derv, '*'
  3. atom, Derv, '*'
  4. '(', subExpr, ')', Derv, '*'
  5. '(',atom, ASGN, subExpr, ')', Derv, '*'
  • development of the 3rd:
  1. nothing
  2. subject, Derv, '*'
  3. atom, Derv, '*'
  4. '(', subExpr, ')', Derv, '*'
  5. '(', arg, ')', Derv, '*'
  6. '(', subject, ')', Derv, '*'
  7. '(', atom, ')', Derv, '*'

So set right associativity to 'subject`. Then

Unresolved conflict for symbol sequence:

  '⟨'  IMM_BLK  •  '⋄'  …

Possible interpretations:

  1:  '⟨'  (blMod_1  IMM_BLK)  •  '⋄'  …
  2:  '⟨'  (blMod_2_  IMM_BLK)  •  '⋄'  …

Possible resolutions:

  1:  Specify a higher precedence in `blMod_1` than in the other rules.
  2:  Specify a higher precedence in `blMod_2_` than in the other rules.
  3:  Add a conflict for these rules: `blMod_1`, `blMod_2_`

So finally I understood the 'three':

Three additional rules apply to blocks, allowing the ambiguous grammar above to be disambiguated.

Then I got

Unresolved conflict for symbol sequence:

  '{'  '·'  •  '⋄'  …

Possible interpretations:

  1:  '{'  (LHS_SUB  '·')  •  '⋄'  …
  2:  '{'  (nothing  '·')  •  '⋄'  …  (precedence: 0, associativity: Left)

Possible resolutions:

  1:  Specify a higher precedence in `nothing` than in the other rules.
  2:  Specify a higher precedence in `LHS_SUB` than in the other rules.
  3:  Add a conflict for these rules: `nothing`, `LHS_SUB`

seeking the culprit:

Unresolved conflict for symbol sequence:

  '('  Derv  '·'  •  '$.FuncDerv'  …

Possible interpretations:

  1:  '('  (nothing  Derv  '·')  •  '$.FuncDerv'  …  (precedence: 0, associativity: Left)
  2:  '('  Derv  (nothing  '·')  •  '$.FuncDerv'  …  (precedence: 0, associativity: Left)

or

Unresolved conflict for symbol sequence:

  Operand  '{'  '·'  •  '⋄'  …

Possible interpretations:

  1:  Operand  '{'  (LHS_SUB  '·')  •  '⋄'  …
  2:  Operand  '{'  (nothing  '·')  •  '⋄'  …  (precedence: 0, associativity: Left)

Possible resolutions:

  1:  Specify a higher precedence in `nothing` than in the other rules.
  2:  Specify a higher precedence in `LHS_SUB` than in the other rules.
  3:  Add a conflict for these rules: `nothing`, `LHS_SUB`
  • blFunc > ARG_BLK > A_CASE > Func > body > stmt > nothing
  • blFunc > ARG_BLK > A_CASE > ARG_HEAD > lhsComp > LHS_SUB > "·"