-
Notifications
You must be signed in to change notification settings - Fork 189
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
feat: handwritten parser #6180
feat: handwritten parser #6180
Conversation
Approved! 🤩 Thank you! I'll merge this... 🤞 Worse case scenario we can revert it, or fix things if we find them 😄 |
feat(test): Fuzz test stdlib hash functions (noir-lang/noir#6233) fix: handle nested arrays in calldata (noir-lang/noir#6232) feat: add more `Type` and `UnresolvedType` methods (noir-lang/noir#5994) fix: Panic on composite types within databus (noir-lang/noir#6225) feat(perf): Follow array sets backwards in array set from get optimization (noir-lang/noir#6208) fix: check for Schnorr null signature (noir-lang/noir#6226)
feat(test): Fuzz test stdlib hash functions (noir-lang/noir#6233) fix: handle nested arrays in calldata (noir-lang/noir#6232) feat: add more `Type` and `UnresolvedType` methods (noir-lang/noir#5994) fix: Panic on composite types within databus (noir-lang/noir#6225) feat(perf): Follow array sets backwards in array set from get optimization (noir-lang/noir#6208) fix: check for Schnorr null signature (noir-lang/noir#6226)
feat(test): Fuzz test stdlib hash functions (noir-lang/noir#6233) fix: handle nested arrays in calldata (noir-lang/noir#6232) feat: add more `Type` and `UnresolvedType` methods (noir-lang/noir#5994) fix: Panic on composite types within databus (noir-lang/noir#6225) feat(perf): Follow array sets backwards in array set from get optimization (noir-lang/noir#6208) fix: check for Schnorr null signature (noir-lang/noir#6226)
feat(test): Fuzz test stdlib hash functions (noir-lang/noir#6233) fix: handle nested arrays in calldata (noir-lang/noir#6232) feat: add more `Type` and `UnresolvedType` methods (noir-lang/noir#5994) fix: Panic on composite types within databus (noir-lang/noir#6225) feat(perf): Follow array sets backwards in array set from get optimization (noir-lang/noir#6208) fix: check for Schnorr null signature (noir-lang/noir#6226)
Automated pull of development from the [noir](https://github.com/noir-lang/noir) programming language, a dependency of Aztec. BEGIN_COMMIT_OVERRIDE feat: handwritten parser (noir-lang/noir#6180) feat(test): Fuzz test stdlib hash functions (noir-lang/noir#6233) fix: handle nested arrays in calldata (noir-lang/noir#6232) feat: add more `Type` and `UnresolvedType` methods (noir-lang/noir#5994) fix: Panic on composite types within databus (noir-lang/noir#6225) feat(perf): Follow array sets backwards in array set from get optimization (noir-lang/noir#6208) fix: check for Schnorr null signature (noir-lang/noir#6226) END_COMMIT_OVERRIDE --------- Co-authored-by: sirasistant <[email protected]>
Hello, we have noticed a significant speedup in running the complete test suite from the root of the project (with We were just wondering: could it be related to this PR? It's so fast that we are actually suspicious whether the tests are running or not 😅 ... but they seem to be. |
Hi! Indeed, it's related to this PR. I think
|
# Description ## Problem We currently parse `unconstrained pub fn ...` but ideally we'd want it to be `pub unconstrained fn ...` See this comment too: #6180 (comment) ## Summary This PR implements the above, but actually all of these: - We now allow `unconstrained pub fn ...` and `pub unconstrained fn` (the former for backwards compatibility) - The formatter will change `unconstrained pub fn` to `pub unconstrained fn` (so after some time we can remove the backwards-compatibility case) - The formatter will now format a function "header" (I didn't know what to call it): that's the fn outer comments, attributes, and modifiers. For example before this PR if you wrote `pub fn foo() {}` it was left untouched, but now it's changed to `pub fn foo() {}`. ## Additional Context None. ## Documentation Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings.
Description
Resolves #853
Problem
There are some issues with the current parser:
if-else-if
)Summary
This PR implements a hand-written parser. It parses any program with just one look-ahead token. It has very good error-recovery.
I tested the parser's performance by copying the contents of
noir-contracts/contracts/avm_test_contract/src/main.nr
in Aztec-Packages 100 times to a single file. That ends up with a file of about 57K lines. The times:Some other benefits:
quote { ... }.as_expr()
, etc, invoke the parser). For exampletest_programs/noir_test_success/comptime_expr/src/main.nr
takes around one second with chumsky and 140ms with the handwritten parser (to donargo compile
)impl
s andtraits
that we needed for chumsky (and the lifetimes, and passing parsers around, and cloning them, and callingboxed()
, etc.) are gone, which I believe make the code much simpler. That said, chumsky has great helpers to be able to parse things separated by, say, a comma, and this PR at least has that too (parse_many
).I tested this parser by running
./boostrap.sh
on the Aztec-Packages contracts and they compile file (of course they didn't compile right away, I had to fix some bugs to get there).Additional Context
Documentation
Check one:
PR Checklist
cargo fmt
on default settings.