Skip to content
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

Add Noir/Rust syntax example section #22

Merged
merged 6 commits into from
Oct 2, 2024
Merged

Add Noir/Rust syntax example section #22

merged 6 commits into from
Oct 2, 2024

Conversation

jzaki
Copy link
Contributor

@jzaki jzaki commented Sep 25, 2024

Description

Problem*

More closely comparing/contrasting the syntax of Noir against Rust, by examples. Starting with simple_macros and loops.

Related AztecProtocol/dev-rel#405
Resolves AztecProtocol/dev-rel#406

Summary*

Putting Noir/Rust side-by-side, and focus on syntax and any design considerations.

Additional Context

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@jzaki jzaki marked this pull request as ready for review October 1, 2024 11:35
@jzaki jzaki requested review from signorecello and saleel October 1, 2024 11:35
noir_by_example/simple_macros/noir/Nargo.toml Show resolved Hide resolved

## Running main

- `nargo execute`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the following error when running this from the noir_by_example folder using nargo version 0.33

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated instructions to run check and add Prover.toml values

- Noir example in [(Quasi) Quote](https://noir-lang.org/docs/dev/noir/concepts/comptime#lowering)
- Rust example in [macros](https://doc.rust-lang.org/rust-by-example/macros.html)

Example functions can be added to [main.nr](./noir/src/main.nr) with a 1:1 corresponding [main.rs](./rust/src/main.rs) equivalent.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are no main.nr or main.rs files at these locations.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was from old structure. Removed.

@jzaki jzaki force-pushed the jz/noir-by-example branch from 15c5864 to 8ed4bdf Compare October 2, 2024 14:59
@jzaki
Copy link
Contributor Author

jzaki commented Oct 2, 2024

Increased section depth of all sections (to have just one top level #)

@jzaki jzaki requested a review from critesjosh October 2, 2024 15:03
Copy link
Collaborator

@critesjosh critesjosh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nit but otherwise good 👍

@jzaki jzaki merged commit 2b9a230 into master Oct 2, 2024
2 checks passed
@jzaki jzaki deleted the jz/noir-by-example branch October 2, 2024 19:22
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.

Rust / Noir syntax examples side-by-side
2 participants