tamarin-prover / tamarin-prover

Main source code repository of the Tamarin prover for security protocol verification.
https://tamarin-prover.com/
GNU General Public License v3.0
418 stars 136 forks source link

Conflict in tree-sitter grammar #685

Open jdreier opened 1 month ago

jdreier commented 1 month ago

When compiling the tree-sitter grammar (running make in the tree-sitter directory) I get the following error:

cd tree-sitter-spthy && tree-sitter generate
Warning: rule non_deterministic_choice is just a `seq` or `choice` rule with a single element. This is unnecessary.
Unresolved conflict for symbol sequence:

  'theory'  ident  'begin'  'process'  ':'  '('  mset_term  •  ')'  …

Possible interpretations:

  1:  'theory'  ident  'begin'  'process'  ':'  '('  (_term  mset_term)  •  ')'  …
  2:  'theory'  ident  'begin'  'process'  ':'  (nested_term  '('  mset_term  •  ')')  (precedence: 'NESTED')

Possible resolutions:

  1:  Specify a higher precedence in `nested_term` than in the other rules.
  2:  Specify a higher precedence in `_term` than in the other rules.
  3:  Specify a left or right associativity in `_term`
  4:  Add a conflict for these rules: `_term`, `nested_term`

make: *** [generate] Error 1
jdreier commented 1 month ago

I guess to prevent such problems in the future compiling the grammar should become part of the checks done by the CI script.

rkunnema commented 1 month ago

Hmm, I don't get this message in current develop. What version tree-sitter do you have? I've got

❯ tree-sitter --version
tree-sitter 0.22.6
jdreier commented 1 month ago

The makefile automatically installs/updates tree-sitter.

tree-sitter % make
cargo install tree-sitter-cli
    Updating crates.io index
  Downloaded tree-sitter-cli v0.24.2
  Downloaded 1 crate (159.5 KB) in 0.82s
  Installing tree-sitter-cli v0.24.2
    Updating crates.io index
     Locking 168 packages to latest compatible versions
      Adding encode_unicode v0.3.6 (latest: v1.0.0)
      Adding hashbrown v0.14.5 (latest: v0.15.0)
      Adding idna v0.5.0 (latest: v1.0.2)
      Adding jni-sys v0.3.0 (latest: v0.4.0)
      Adding linux-raw-sys v0.4.14 (latest: v0.6.5)
      Adding unicode-width v0.1.14 (latest: v0.2.0)
      Adding wasi v0.11.0+wasi-snapshot-preview1 (latest: v0.13.2+wasi-0.2.1)
      Adding wasmparser v0.217.0 (latest: v0.218.0)
      Adding windows-sys v0.45.0 (latest: v0.59.0)
      Adding windows-sys v0.48.0 (latest: v0.59.0)
      Adding windows-sys v0.52.0 (latest: v0.59.0)
      Adding windows-targets v0.42.2 (latest: v0.52.6)
      Adding windows-targets v0.48.5 (latest: v0.52.6)
      Adding windows_aarch64_gnullvm v0.42.2 (latest: v0.52.6)
      Adding windows_aarch64_gnullvm v0.48.5 (latest: v0.52.6)
      Adding windows_aarch64_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_aarch64_msvc v0.48.5 (latest: v0.52.6)
      Adding windows_i686_gnu v0.42.2 (latest: v0.52.6)
      Adding windows_i686_gnu v0.48.5 (latest: v0.52.6)
      Adding windows_i686_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_i686_msvc v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_gnu v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_gnu v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_gnullvm v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_gnullvm v0.48.5 (latest: v0.52.6)
      Adding windows_x86_64_msvc v0.42.2 (latest: v0.52.6)
      Adding windows_x86_64_msvc v0.48.5 (latest: v0.52.6)
      Adding zerocopy v0.7.35 (latest: v0.8.2)
      Adding zerocopy-derive v0.7.35 (latest: v0.8.2)
  Downloaded once_cell v1.20.2
  Downloaded cc v1.1.28
  Downloaded tree-sitter-highlight v0.24.2
  Downloaded tree-sitter v0.24.2
  Downloaded tree-sitter-tags v0.24.2
  Downloaded tree-sitter-config v0.24.2
  Downloaded tree-sitter-loader v0.24.2
  Downloaded tree-sitter-generate v0.24.2
  Downloaded 8 crates (2.7 MB) in 1.16s (largest was `tree-sitter-generate` at 2.3 MB)
   Compiling proc-macro2 v1.0.86
   Compiling unicode-ident v1.0.13
   Compiling libc v0.2.159
   Compiling cfg-if v1.0.0
   Compiling serde v1.0.210
   Compiling memchr v2.7.4
   Compiling shlex v1.3.0
   Compiling regex-syntax v0.8.5
   Compiling once_cell v1.20.2
   Compiling bitflags v2.6.0
   Compiling tinyvec_macros v0.1.1
   Compiling byteorder v1.5.0
   Compiling thiserror v1.0.64
   Compiling rustix v0.38.37
   Compiling tinyvec v1.8.0
   Compiling equivalent v1.0.1
   Compiling hashbrown v0.15.0
   Compiling cc v1.1.28
   Compiling anyhow v1.0.89
   Compiling streaming-iterator v0.1.9
   Compiling utf8parse v0.2.2
   Compiling semver v1.0.23
   Compiling aho-corasick v1.1.3
   Compiling lazy_static v1.5.0
   Compiling unicode-bidi v0.3.17
   Compiling tree-sitter-language v0.1.2
   Compiling version_check v0.9.5
   Compiling percent-encoding v2.3.1
   Compiling serde_json v1.0.128
   Compiling unicode-normalization v0.1.24
   Compiling form_urlencoded v1.2.1
   Compiling ahash v0.8.11
   Compiling anstyle-parse v0.2.5
   Compiling itoa v1.0.11
   Compiling is_terminal_polyfill v1.70.1
   Compiling cfg_aliases v0.2.1
   Compiling anstyle v1.0.8
   Compiling colorchoice v1.0.2
   Compiling ryu v1.0.18
   Compiling idna v0.5.0
   Compiling anstyle-query v1.1.1
   Compiling tree-sitter v0.24.2
   Compiling regex-automata v0.4.8
   Compiling option-ext v0.2.0
   Compiling anstream v0.6.15
   Compiling quote v1.0.37
   Compiling nix v0.29.0
   Compiling log v0.4.22
   Compiling strsim v0.11.1
   Compiling syn v2.0.79
   Compiling errno v0.3.9
   Compiling dirs-sys v0.4.1
   Compiling getrandom v0.2.15
   Compiling fastrand v2.1.1
   Compiling clap_lex v0.7.2
   Compiling heck v0.5.0
   Compiling clap_builder v4.5.19
   Compiling rand_core v0.6.4
   Compiling dirs v5.0.1
   Compiling thread_local v1.1.8
   Compiling indoc v2.0.5
   Compiling tree-sitter-loader v0.24.2
   Compiling unicode-width v0.1.14
   Compiling core-foundation-sys v0.8.7
   Compiling fuzzy-matcher v0.3.7
   Compiling tempfile v3.13.0
   Compiling fs4 v0.9.1
   Compiling console v0.15.8
   Compiling regex v1.11.0
   Compiling core-foundation v0.10.0
   Compiling libloading v0.8.5
   Compiling chunked_transfer v1.5.0
   Compiling rustc-hash v2.0.0
   Compiling zeroize v1.8.1
   Compiling path-slash v0.2.1
   Compiling ascii v1.1.0
   Compiling same-file v1.0.6
   Compiling httpdate v1.0.3
   Compiling tree-sitter-cli v0.24.2
   Compiling smallbitvec v2.5.3
   Compiling utf8-width v0.1.7
   Compiling shell-words v1.1.0
   Compiling html-escape v0.2.13
   Compiling tiny_http v0.12.0
   Compiling serde_derive v1.0.210
   Compiling zerocopy-derive v0.7.35
   Compiling thiserror-impl v1.0.64
   Compiling clap_derive v4.5.18
   Compiling ctor v0.2.8
   Compiling walkdir v2.5.0
   Compiling ctrlc v3.4.5
   Compiling bstr v1.10.0
   Compiling filetime v0.2.25
   Compiling similar v2.6.0
   Compiling glob v0.3.1
   Compiling zerocopy v0.7.35
   Compiling ppv-lite86 v0.2.20
   Compiling rand_chacha v0.3.1
   Compiling clap v4.5.19
   Compiling dialoguer v0.11.0
   Compiling rand v0.8.5
   Compiling clap_complete v4.5.32
   Compiling tree-sitter-highlight v0.24.2
   Compiling tree-sitter-tags v0.24.2
   Compiling indexmap v2.6.0
   Compiling url v2.5.2
   Compiling hashbrown v0.14.5
   Compiling webbrowser v1.0.2
   Compiling wasmparser v0.217.0
   Compiling tree-sitter-config v0.24.2
   Compiling tree-sitter-generate v0.24.2
    Finished `release` profile [optimized] target(s) in 28.85s
   Replacing /Users/jannik/.cargo/bin/tree-sitter
    Replaced package `tree-sitter-cli v0.24.1` with `tree-sitter-cli v0.24.2` (executable `tree-sitter`)
warning: be sure to add `/Users/jannik/.cargo/bin` to your PATH to be able to run the installed binaries
cd tree-sitter-spthy && tree-sitter generate
Warning: rule non_deterministic_choice is just a `seq` or `choice` rule with a single element. This is unnecessary.
Unresolved conflict for symbol sequence:

  'theory'  ident  'begin'  'process'  ':'  '('  mset_term  •  ')'  …

Possible interpretations:

  1:  'theory'  ident  'begin'  'process'  ':'  '('  (_term  mset_term)  •  ')'  …
  2:  'theory'  ident  'begin'  'process'  ':'  (nested_term  '('  mset_term  •  ')')  (precedence: 'NESTED')

Possible resolutions:

  1:  Specify a higher precedence in `nested_term` than in the other rules.
  2:  Specify a higher precedence in `_term` than in the other rules.
  3:  Specify a left or right associativity in `_term`
  4:  Add a conflict for these rules: `_term`, `nested_term`

make: *** [generate] Error 1