Skip to content

CompatHelper: bump compat for JuliaSyntax to 1, (keep existing compat) #287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

github-actions[bot]
Copy link
Contributor

This pull request changes the compat entry for the JuliaSyntax package from 0.4 to 0.4, 1.
This keeps the compat entries for earlier versions.

Note: I have not tested your package with this new compat entry.
It is your responsibility to make sure that your package tests pass before you merge this pull request.

@sunxd3 sunxd3 force-pushed the compathelper/new_version/2025-03-29-00-06-39-104-02116669264 branch from 90c4f61 to 34c7f00 Compare March 29, 2025 00:06
@sunxd3
Copy link
Member

sunxd3 commented Apr 4, 2025

This is not a trivial fix, for now, I'll write down some potential changes required, and come back when I have time.

  • true, false are no longer tokenized as two separate kinds of tokens, but the same token K"Bool" (Replace K"true" and K"false" with K"Bool" JuliaLang/JuliaSyntax.jl#488)
  • <- is parsed differently
    • v0.4.10
      julia> tokenize("p <- dnorm(0, 1)")
      12-element Vector{Token}:
       Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x00000001:0x00000001)
       Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000002:0x00000002)
       Token(JuliaSyntax.SyntaxHead(K"<", 0x0000), 0x00000003:0x00000003)
       Token(JuliaSyntax.SyntaxHead(K"-", 0x0000), 0x00000004:0x00000004)
       Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000005:0x00000005)
       Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x00000006:0x0000000a)
       Token(JuliaSyntax.SyntaxHead(K"(", 0x0001), 0x0000000b:0x0000000b)
       Token(JuliaSyntax.SyntaxHead(K"Integer", 0x0000), 0x0000000c:0x0000000c)
       Token(JuliaSyntax.SyntaxHead(K",", 0x0001), 0x0000000d:0x0000000d)
       Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x0000000e:0x0000000e)
       Token(JuliaSyntax.SyntaxHead(K"Integer", 0x0000), 0x0000000f:0x0000000f)
       Token(JuliaSyntax.SyntaxHead(K")", 0x0001), 0x00000010:0x00000010)
    • 1.0.2
      julia> tokenize("p <- dnorm(0, 1)")
      12-element Vector{Token}:
       Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x00000001:0x00000001)
       Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000002:0x00000002)
       Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x00000003:0x00000003)
       Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x00000004:0x00000004)
       Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x00000005:0x00000005)
       Token(JuliaSyntax.SyntaxHead(K"Identifier", 0x0000), 0x00000006:0x0000000a)
       Token(JuliaSyntax.SyntaxHead(K"(", 0x0001), 0x0000000b:0x0000000b)
       Token(JuliaSyntax.SyntaxHead(K"Integer", 0x0000), 0x0000000c:0x0000000c)
       Token(JuliaSyntax.SyntaxHead(K",", 0x0001), 0x0000000d:0x0000000d)
       Token(JuliaSyntax.SyntaxHead(K"Whitespace", 0x0001), 0x0000000e:0x0000000e)
       Token(JuliaSyntax.SyntaxHead(K"Integer", 0x0000), 0x0000000f:0x0000000f)
       Token(JuliaSyntax.SyntaxHead(K")", 0x0001), 0x00000010:0x00000010)
    i.e., <- is now parsed as two K"Identifier" instead of K"<" and K"-", but this is something I relied on in the
    parser

Figure out:

  • What version of JuliaSyntax is Julia 1.10 using? How about Julia 1.2? (This is potentially related to when I must fix this)
  • Even if in a future version of Julia when JuliaSyntax 1.0 is used, must I update from JuliaSyntax 0.4, or both version can be used?

@sunxd3 sunxd3 mentioned this pull request May 14, 2025
16 tasks
Copy link
Contributor Author

JuliaBUGS.jl documentation for PR #287 is available at:
https://TuringLang.github.io/JuliaBUGS.jl/previews/PR287/

@coveralls
Copy link

coveralls commented May 15, 2025

Pull Request Test Coverage Report for Build 15043798846

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.006%) to 83.518%

Files with Coverage Reduction New Missed Lines %
src/parser/bugs_parser.jl 1 89.09%
Totals Coverage Status
Change from base Build 14887157894: 0.006%
Covered Lines: 2108
Relevant Lines: 2524

💛 - Coveralls

Copy link
Contributor Author

Benchmark results on macOS (aarch64)

BridgeStan not found at location specified by $BRIDGESTAN environment variable, downloading version 2.6.2 to /Users/runner/.bridgestan/bridgestan-2.6.2
Done!

Stan results:

Model Parameters Density Time (µs) Density+Gradient Time (µs)
rats 65 5.0916 7.22233
pumps 12 0.873136 0.966346
bones 13 79.541 90.458
oxford 244 11.521 13.6875
epil 303 36.0 39.542
lsat 1006 107.416 151.645
schools 133 222.25 351.188
beetles 2 0.722925 0.803941
air 5 0.783784 0.8986

JuliaBUGS Mooncake results:

Model Parameters Density Time (µs) Density+Gradient Time (µs)
rats 65 1.16668 7.19775
pumps 12 0.458338 1.80988
bones 33 47.083 244.75
oxford 244 21.125 51.75
epil 303 7.146 34.75
lsat 1006 55.083 237.667
schools 133 90.75 1027.08
beetles 2 1.02441 3.97029
air 5 0.288527 1.16286

Benchmark results on Ubuntu (x64)

BridgeStan not found at location specified by $BRIDGESTAN environment variable, downloading version 2.6.2 to /home/runner/.bridgestan/bridgestan-2.6.2
Done!

Stan results:

Model Parameters Density Time (µs) Density+Gradient Time (µs)
rats 65 5.1636 7.52733
pumps 12 0.960467 1.20379
bones 13 73.057 90.208
oxford 244 13.836 17.7935
epil 303 27.432 33.894
lsat 1006 153.547 195.155
schools 133 507.84 742.579
beetles 2 0.832429 0.9698
air 5 0.661909 0.788757

JuliaBUGS Mooncake results:

Model Parameters Density Time (µs) Density+Gradient Time (µs)
rats 65 1.993 14.3015
pumps 12 0.595204 2.42367
bones 33 47.2535 344.486
oxford 244 23.424 72.876
epil 303 10.8005 55.935
lsat 1006 90.88 365.869
schools 133 103.309 1078.99
beetles 2 1.09823 4.68533
air 5 0.338333 1.3881

@sunxd3
Copy link
Member

sunxd3 commented May 15, 2025

The two fixes down in this PR are:

  1. by default, operators are parsed as K"Identifier" in v1.0: Parse non-syntactic operator tokens as K"Identifier" kind JuliaLang/JuliaSyntax.jl#523
  2. K"true" and K"false" are replaced with K"Bool"

1 is solved by setting a keyword argument of tokenize function, 2 is specially handled.

@sunxd3 sunxd3 merged commit 53aabde into main May 15, 2025
11 of 14 checks passed
@sunxd3 sunxd3 deleted the compathelper/new_version/2025-03-29-00-06-39-104-02116669264 branch May 15, 2025 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants