-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Enable JuliaSyntax.jl as the default Julia parser #46372
Conversation
deps/checksums/JuliaSyntax-25b737b1bbce259451f6d79997a25c541e7ab8c1.tar.gz/sha512
Outdated
Show resolved
Hide resolved
df6821e
to
50a8f5d
Compare
Can we drop the implied |
It is really cool to see how small this is! And exciting! |
Yes :-) Already done on a WIP branch of mine, will be merged soon. BTW, for anyone wondering what's happening here - all the development is happening over at JuliaSyntax.jl which is why this PR is just sitting around at the moment. I'll get back to this PR once I've sorted out a few remaining large usability problems (Particularly generating |
Now that version 0.2 of JuliaSyntax has been released, can this PR be updated to use it? We have 2 weeks left if we want to merge this in the 1.9 timeframe. |
Can it be merged, and with it on by default? Would it be good for PkgEval, or should it alternatively be run with:
I'm not necessarily thinking it should be in Julia 1.9-rc1, it just think it might be good to have it from now or the feature freeze (up to then) to check, and not have to explain the ENV to users (and you will likely not get feedback from master users with a non-default option), though this should also be a possibility:
|
Yep I've got julia-1.9 in mind for this. Will probably do a JuliaSyntax-0.3 release prior to that.
I don't think we're ready to turn this on by default. |
PkgEval currently doesn't configuring environment flags, so to test this either add a commit that enables the new parser by default, or add a Make flag that results in the new parser being used by default (which can then be set using the |
Tried running this under PkgEval with the new parser enabled by default (using the latest JuliaSyntax.jl, not the one from this PR), but Julia fails to bootstrap:
I'll probably add an |
@nanosoldier |
Your package evaluation job has completed - possible new issues were detected. A full report can be found here. |
Packages that seem to occur a lot in failure logs: Macrotools, Unitful, and CpuId. |
|
This seems rather bad, but comparing to some random other PkgEval, about half failing isn't unusual (for all kinds of reasons including syntax): I'm amazed by how long it takes (and not scalable, with package ecosystem increasing), but is the timing maybe (only slightly?) better here? This one has timing: #45646 (comment) |
The timings cannot be compared, as quite some packages now fail to precompile and thus never execute any test. |
It is honestly kind of silly to use PkgEval to test this, since we could just test that everything parses the same between the 2 versions (which would allow us to skip loading the code and running the tests). |
The CpuId failure is due to something like commas after new lines:
However, that parses fine if you use the current |
yeah. this pr is still using 0.1 but should be using 0.2 |
Using existing infrastructure to quickly get a result instead of having to write something tailor made that wouldn't have gotten any better results in the end seems to me like an efficient use of resources, not something silly. |
fair :). I'm coming from the perspective that we'll probably have to run this between 10 and 100 times, at which point the balance might shift. |
especially since the custom version could give more information per run since pkgeval doesn't give us errors for packages that have a failing dependency and does give us spurious errors for the thousand or so packages with bad CI |
ba2364a
to
e703d0b
Compare
This is more consistent with the way we're likely call it from the Julia side via Meta.parse().
REPL completion of paths within strings need to be escaped according to the usual escaping rules, and delimited by the starting " rather than whitespace. This differs from completion of paths within cmd backticks which need to be escaped according to shell escaping rules. Separate these cases and fix string escaping. This was found because JuliaSyntax emits an Expr(:error) rather than Expr(:incomplete) for paths inside strings with invalid escape sequences before whitespace.
* Vendor JuliaSyntax into Base via deps directory * Install JuliaSyntax as the Julia parser unless the environment variable JULIA_USE_NEW_PARSER=0 is set. * Add a function to set the Core._parse binding. Required because we'd like to set the binding during Base.__init__. This can be done with `Core.eval` but that doesn't work well in incremental compilation mode. Also accommodate JuliaSyntax within tests: * When JuliaSyntax is enabled, ignore error messages in parser tests which are tested separately upstream - error messages are inherently expressed a bit differently when they go alongside full source location info. * Accommodate a small number of incompatibilities where in JuliaSyntax - `import .Mod.x as (a.b)` is a syntax not lowering error - `f(2x for x=1:10, y` is `Expr(:incomplete)` not `Expr(:error)` - `incomplete_tag` is more precise for `:block` vs `:other` - `global const` without an assignment is a syntax error, in keeping with plain `const` without assignment being a syntax error (not lowering error). * Adjust a few tests to be more precise about testing lowering vs the parser. * Make Meta.parse doctest compatible with JuliaSyntax errors
e2896b5
to
60bf0b6
Compare
Any idea what's up with the i686 windows build? We seem to have an LLVM out of memory error. But I think a previous build on this same branch succeeded, then failed, then succeeded again with this same error on the i686 build. So it might be build environment related? Snip of build log:
|
@gbaraldi said that error has been seen in other PRs, so it doesn't seem to be specific to this one. |
Well, I've seen it in #50144, which is a PR that does mess with the GC, but I do think we near the limit when compiling the sysimg at 32 bit. |
#50205 it's broken also on master. |
@giordano thanks, what a relief. I also tried to repro the LLVM out of memory on the i686 windows build locally with cygwin, and could not. |
I think this is good to go. I'll do one last nanosoldier run and have a look through those results before merging. @nanosoldier |
Your package evaluation job has completed - possible new issues were detected. |
Thank you so much @c42f for all the work to make this a reality! |
Ah. I must admit I was really really looking forward to pushing the merge button on this myself. It kind of felt symbolic given this was like 1.5 years of work. (Not if it meant missing feature freeze, but that's tomorrow morning my time IIUC?) I was just preparing a final minor bugfix based on the latest nanosolider run. I'll make a separate PR for that. Thanks for the enthusiasm anyway! |
I think there may be some elements, such as the method of merging, that would be better handled by @c42f . If you feel it's preferrable, we wouldn't mind if the PR were to be temporarily reverted and reland it quickly with minor fixes, what are your thoughts? When it comes to major PRs like this one, it often seems best if the person who created the PR decides matters such as whether to squash the commits. Regarding the feature freeze, it's set to be extended until the 27th of June, so there's no need to get hurry just yet:) |
At this point I'd rather not revert this - that will just cause extra churn. I think it'll be fine just to put a separate PR in for any minor fixes because this was very, very close and the remaining bug I know about doesn't seem very disruptive. Luckily I'd already rearranged the commits into logical order and done a bunch of squashing so that side of it was in pretty good shape. |
This enables the use of JuliaSyntax.jl as the Julia parser for the runtime, which greatly improves parser error messages in various cases.
As an experimental feature, this is only enabled if theUpdate: it's the default!JULIA_USE_NEW_PARSER=true
environment variable is set.For now I've installed it after bootstrapping because this is the simplest (flisp parser still used for bootstrap). In the future we can solve bootstrapping but this isn't necessary right away.
API Versioning: Stdlib woes vs vendoring
The simplest way to get this working immediately was as a stdlib. However in retrospect this has several downsides:
JuliaSyntax
API is not at all stable. The only stable API for using this fromBase
should beMeta.parse()
andExpr
. Therefore, I think users should not really be able to dousing JuliaSyntax
and get the version bundled with Base.Base
someone is using. Users should be able to install a "normal" version ofJuliaSyntax
viaPkg
.So I think having this as a stdlib doesn't really make sense and we are left with some kind of vendoring approach. I think what I'll try next is to include the parser at the end of building
Base
.Having said all that, it should be easy to try this out already :-)
Fixes #31449