ocaml-tree-sitter-core icon indicating copy to clipboard operation
ocaml-tree-sitter-core copied to clipboard

ocaml-tree-sitter displays different behavior to tree-sitter

Open patrick-nicodemus opened this issue 8 months ago • 0 comments

I started trying to set up ocaml-tree-sitter to work with https://github.com/milisims/tree-sitter-org. I ran into one problem mentioned in another issue #78, however I patched that one just by renaming "non-immediate" to "nonimmediate" everywhere.

The next issue I ran into is the following.

org: Importing initial 'grammar.json'.
org: Simplifying 'grammar.json' for ocaml-tree-sitter.
org: Recovering informational JS grammars from JSON.
org: Generating definitive 'parser.c'.
Unresolved conflict for symbol sequence:

  multiline_text_repeat1  •  ':'  …

Possible interpretations:

  1:  (multiline_text  multiline_text_repeat1)  •  ':'  …
  2:  (multiline_text_repeat1  multiline_text_repeat1  •  multiline_text_repeat1)

Possible resolutions:

  1:  Specify a left or right associativity in `multiline_text`
  2:  Add a conflict for these rules: `multiline_text`

Now it may be that there is a problem with the original grammar, and I should take it up with the administrators of the grammar repository, but if I run the tree-sitter CLI on the grammar.js in the org grammar repository, I don't get any warnings or complaints, and so I was wondering if there's a difference in how the files are processed.

(I tried running the OCaml code generation tool directly on the C file that is in the org grammar git repository, and it gave an OCaml program which compiled fine, but it didn't work correctly on my test data. I presume this is to be expected because it's not how the tool is designed to be used.)

patrick-nicodemus avatar Jun 13 '24 20:06 patrick-nicodemus