Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions book/src/rfc/rfc-0-generic-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ The current pipeline of compiling noname code is:
1. Parse the code into AST
2. Convert the AST into NAST with naming resolution
3. Convert the NAST into TAST with type metadata collection and type checking
4. Circuit synthesizing TAST into an constraint system
4. Circuit synthesizing TAST into a constraint system

With generic parameters, the current TAST phase can't handle the type checking anymore, because the generic parameters are unknown. For example, it can't type check the array with symbolic size without resolving the values for the generic parameters.

Expand Down Expand Up @@ -438,7 +438,7 @@ Circuit synthesizer will rely on the monomorphized AST to compile the circuit. T
## Alternative approach
[One alternative approach](https://github.com/zksecurity/noname/pull/136) to the monomorphization described above is to propagate the generic values directly in circuit writer, without the need to add the MAST phase.

The circuit writer walks through the original AST via the `compile_expr` function. This function propagate the values from the main function argument and constants and compute the `VarOrRef` as an result. The `VarOrRef` doesn't return the structure of the types being computed.
The circuit writer walks through the original AST via the `compile_expr` function. This function propagate the values from the main function argument and constants and compute the `VarOrRef` as a result. The `VarOrRef` doesn't return the structure of the types being computed.

In the process, when it needs to determine the structure of the type behind an expression node, it relies on the `size_of` function to determine the number of vars representing the type. The `size_of` relies on the node id of an expression to look up the type. This is not a problem when the types are concrete.

Expand Down
2 changes: 1 addition & 1 deletion src/mast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ fn monomorphize_expr<B: Backend>(
_ => Err(Error::new(
"Container Access",
ErrorKind::UnexpectedError(
"Attempting to access container when type is not an container",
"Attempting to access container when type is not a container",
),
expr.span,
))?,
Expand Down
2 changes: 1 addition & 1 deletion src/syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub fn is_numeric(s: &str) -> bool {
s.chars().all(|c| c.is_ascii_digit())
}

/// Returns true if the given string is an hexadecimal string (0x...)
/// Returns true if the given string is a hexadecimal string (0x...)
pub fn is_hexadecimal(s: &str) -> bool {
let mut s = s.chars();
let s0 = s.next();
Expand Down
Loading