Merge pull request #1324 from AleoHQ/abnf

[ABNF] Improve nomenclature
This commit is contained in:
Alessandro Coglio 2021-09-08 09:59:52 -07:00 committed by GitHub
commit 3b52459f85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 198 additions and 242 deletions

View File

@ -221,7 +221,7 @@ impl<'a> Scope<'a> {
.collect::<Result<Vec<_>>>()?,
),
SelfType => return Err(AsgError::unexpected_big_self(span).into()),
CircuitOrAlias(name) => {
Identifier(name) => {
if let Some(circuit) = self.resolve_circuit(&name.name) {
Type::Circuit(circuit)
} else if let Some(alias) = self.resolve_alias(&name.name) {

View File

@ -227,7 +227,7 @@ impl<'a> Into<leo_ast::Type> for &Type<'a> {
),
ArrayWithoutSize(type_) => leo_ast::Type::Array(Box::new(type_.as_ref().into()), None),
Tuple(subtypes) => leo_ast::Type::Tuple(subtypes.iter().map(Into::into).collect()),
Circuit(circuit) => leo_ast::Type::CircuitOrAlias(circuit.name.borrow().clone()),
Circuit(circuit) => leo_ast::Type::Identifier(circuit.name.borrow().clone()),
}
}
}

View File

@ -116,7 +116,7 @@ impl Canonicalizer {
fn canonicalize_self_type(&self, type_option: Option<&Type>) -> Option<Type> {
match type_option {
Some(type_) => match type_ {
Type::SelfType => Some(Type::CircuitOrAlias(self.circuit_name.as_ref().unwrap().clone())),
Type::SelfType => Some(Type::Identifier(self.circuit_name.as_ref().unwrap().clone())),
Type::Array(type_, dimensions) => Some(Type::Array(
Box::new(self.canonicalize_self_type(Some(type_)).unwrap()),
dimensions.clone(),
@ -475,7 +475,7 @@ impl Canonicalizer {
identifier: variable.identifier.clone(),
const_: variable.const_,
mutable: variable.mutable,
type_: Type::CircuitOrAlias(self.circuit_name.as_ref().unwrap().clone()),
type_: Type::Identifier(self.circuit_name.as_ref().unwrap().clone()),
span: variable.span.clone(),
});
}

View File

@ -41,7 +41,7 @@ impl<R: ReconstructingReducer> ReconstructingDirector<R> {
Type::Tuple(reduced_types)
}
Type::CircuitOrAlias(identifier) => Type::CircuitOrAlias(self.reduce_identifier(identifier)?),
Type::Identifier(identifier) => Type::Identifier(self.reduce_identifier(identifier)?),
_ => type_.clone(),
};

View File

@ -37,7 +37,7 @@ pub enum Type {
#[serde(serialize_with = "serialize_array")]
Array(Box<Type>, Option<ArrayDimensions>),
Tuple(Vec<Type>),
CircuitOrAlias(Identifier),
Identifier(Identifier), // ex Circuit or Alias
SelfType,
}
@ -53,7 +53,7 @@ impl Type {
/// Returns `true` if the self `Type` is a `Circuit`.
///
pub fn is_circuit(&self) -> bool {
matches!(self, Type::CircuitOrAlias(_))
matches!(self, Type::Identifier(_))
}
///
@ -69,7 +69,7 @@ impl Type {
(Type::Field, Type::Field) => true,
(Type::Group, Type::Group) => true,
(Type::IntegerType(left), Type::IntegerType(right)) => left.eq(right),
(Type::CircuitOrAlias(left), Type::CircuitOrAlias(right)) => left.eq(right),
(Type::Identifier(left), Type::Identifier(right)) => left.eq(right),
(Type::SelfType, Type::SelfType) => true,
(Type::Array(left_type, left_dim), Type::Array(right_type, right_dim)) => {
// Convert array dimensions to owned.
@ -161,7 +161,7 @@ impl fmt::Display for Type {
Type::Field => write!(f, "field"),
Type::Group => write!(f, "group"),
Type::IntegerType(ref integer_type) => write!(f, "{}", integer_type),
Type::CircuitOrAlias(ref variable) => write!(f, "circuit {}", variable),
Type::Identifier(ref variable) => write!(f, "circuit {}", variable),
Type::SelfType => write!(f, "SelfType"),
Type::Array(ref array, ref dimensions) => {
if let Some(dimensions) = dimensions {

View File

@ -266,7 +266,7 @@ impl<R: ReconstructingReducer, O: CombinerOptions> CombineAstAsgDirector<R, O> {
asg: &AsgCircuitAccessExpression,
) -> Result<CircuitMemberAccessExpression> {
let type_ = if self.options.type_inference_enabled() {
Some(leo_ast::Type::CircuitOrAlias(asg.circuit.get().name.borrow().clone()))
Some(leo_ast::Type::Identifier(asg.circuit.get().name.borrow().clone()))
} else {
None
};

View File

@ -476,7 +476,7 @@ Line terminators form whitespace, along with spaces and horizontal tabs.
whitespace = space / horizontal-tab / newline
```
Go to: _[horizontal-tab](#user-content-horizontal-tab), [newline](#user-content-newline), [space](#user-content-space)_;
Go to: _[newline](#user-content-newline), [space](#user-content-space), [horizontal-tab](#user-content-horizontal-tab)_;
There are two kinds of comments in Leo, as in other languages.
@ -494,7 +494,7 @@ the ones used in the Java language reference.
comment = block-comment / end-of-line-comment
```
Go to: _[end-of-line-comment](#user-content-end-of-line-comment), [block-comment](#user-content-block-comment)_;
Go to: _[block-comment](#user-content-block-comment), [end-of-line-comment](#user-content-end-of-line-comment)_;
<a name="block-comment"></a>
@ -511,7 +511,7 @@ rest-of-block-comment = "*" rest-of-block-comment-after-star
/ not-star rest-of-block-comment
```
Go to: _[not-star](#user-content-not-star), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [rest-of-block-comment](#user-content-rest-of-block-comment)_;
Go to: _[rest-of-block-comment](#user-content-rest-of-block-comment), [rest-of-block-comment-after-star](#user-content-rest-of-block-comment-after-star), [not-star](#user-content-not-star)_;
<a name="rest-of-block-comment-after-star"></a>
@ -590,7 +590,7 @@ lowercase-letter = %x61-7A ; a-z
letter = uppercase-letter / lowercase-letter
```
Go to: _[uppercase-letter](#user-content-uppercase-letter), [lowercase-letter](#user-content-lowercase-letter)_;
Go to: _[lowercase-letter](#user-content-lowercase-letter), [uppercase-letter](#user-content-uppercase-letter)_;
The following rules defines (ASCII) decimal, octal, and hexadecimal digits.
@ -774,7 +774,7 @@ character-literal-element = not-single-quote-or-backslash
/ unicode-character-escape
```
Go to: _[unicode-character-escape](#user-content-unicode-character-escape), [simple-character-escape](#user-content-simple-character-escape), [not-single-quote-or-backslash](#user-content-not-single-quote-or-backslash), [ascii-character-escape](#user-content-ascii-character-escape)_;
Go to: _[ascii-character-escape](#user-content-ascii-character-escape), [simple-character-escape](#user-content-simple-character-escape), [unicode-character-escape](#user-content-unicode-character-escape), [not-single-quote-or-backslash](#user-content-not-single-quote-or-backslash)_;
<a name="single-quote-escape"></a>
@ -829,7 +829,7 @@ simple-character-escape = single-quote-escape
/ null-character-escape
```
Go to: _[line-feed-escape](#user-content-line-feed-escape), [single-quote-escape](#user-content-single-quote-escape), [double-quote-escape](#user-content-double-quote-escape), [carriage-return-escape](#user-content-carriage-return-escape), [null-character-escape](#user-content-null-character-escape), [horizontal-tab-escape](#user-content-horizontal-tab-escape), [backslash-escape](#user-content-backslash-escape)_;
Go to: _[line-feed-escape](#user-content-line-feed-escape), [carriage-return-escape](#user-content-carriage-return-escape), [double-quote-escape](#user-content-double-quote-escape), [backslash-escape](#user-content-backslash-escape), [null-character-escape](#user-content-null-character-escape), [single-quote-escape](#user-content-single-quote-escape), [horizontal-tab-escape](#user-content-horizontal-tab-escape)_;
<a name="ascii-character-escape"></a>
@ -865,7 +865,7 @@ string-literal-element = not-double-quote-or-backslash
/ unicode-character-escape
```
Go to: _[unicode-character-escape](#user-content-unicode-character-escape), [simple-character-escape](#user-content-simple-character-escape), [not-double-quote-or-backslash](#user-content-not-double-quote-or-backslash), [ascii-character-escape](#user-content-ascii-character-escape)_;
Go to: _[simple-character-escape](#user-content-simple-character-escape), [unicode-character-escape](#user-content-unicode-character-escape), [not-double-quote-or-backslash](#user-content-not-double-quote-or-backslash), [ascii-character-escape](#user-content-ascii-character-escape)_;
The ones above are all the atomic literals
@ -885,7 +885,7 @@ atomic-literal = untyped-literal
/ string-literal
```
Go to: _[field-literal](#user-content-field-literal), [boolean-literal](#user-content-boolean-literal), [address-literal](#user-content-address-literal), [signed-literal](#user-content-signed-literal), [character-literal](#user-content-character-literal), [string-literal](#user-content-string-literal), [unsigned-literal](#user-content-unsigned-literal), [product-group-literal](#user-content-product-group-literal), [untyped-literal](#user-content-untyped-literal)_;
Go to: _[character-literal](#user-content-character-literal), [unsigned-literal](#user-content-unsigned-literal), [signed-literal](#user-content-signed-literal), [address-literal](#user-content-address-literal), [field-literal](#user-content-field-literal), [untyped-literal](#user-content-untyped-literal), [product-group-literal](#user-content-product-group-literal), [string-literal](#user-content-string-literal), [boolean-literal](#user-content-boolean-literal)_;
After defining the (mostly) alphanumeric tokens above,
@ -929,7 +929,7 @@ token = keyword
/ symbol
```
Go to: _[identifier](#user-content-identifier), [atomic-literal](#user-content-atomic-literal), [package-name](#user-content-package-name), [annotation-name](#user-content-annotation-name), [symbol](#user-content-symbol), [keyword](#user-content-keyword)_;
Go to: _[identifier](#user-content-identifier), [annotation-name](#user-content-annotation-name), [package-name](#user-content-package-name), [keyword](#user-content-keyword), [symbol](#user-content-symbol), [atomic-literal](#user-content-atomic-literal)_;
Tokens, comments, and whitespace are lexemes, i.e. lexical units.
@ -939,7 +939,7 @@ Tokens, comments, and whitespace are lexemes, i.e. lexical units.
lexeme = token / comment / whitespace
```
Go to: _[token](#user-content-token), [comment](#user-content-comment), [whitespace](#user-content-whitespace)_;
Go to: _[token](#user-content-token), [whitespace](#user-content-whitespace), [comment](#user-content-comment)_;
@ -996,7 +996,7 @@ group-type = %s"group"
arithmetic-type = integer-type / field-type / group-type
```
Go to: _[integer-type](#user-content-integer-type), [group-type](#user-content-group-type), [field-type](#user-content-field-type)_;
Go to: _[field-type](#user-content-field-type), [group-type](#user-content-group-type), [integer-type](#user-content-integer-type)_;
The arithmetic types, along with the boolean, address, and character types,
@ -1022,24 +1022,7 @@ character-type = %s"char"
scalar-type = boolean-type / arithmetic-type / address-type / character-type
```
Go to: _[character-type](#user-content-character-type), [boolean-type](#user-content-boolean-type), [address-type](#user-content-address-type), [arithmetic-type](#user-content-arithmetic-type)_;
Circuit types are denoted by identifiers and the keyword `Self`.
The latter is only allowed inside a circuit definition,
to denote the circuit being defined.
<a name="self-type"></a>
```abnf
self-type = %s"Self"
```
<a name="circuit-or-alias-type"></a>
```abnf
circuit-or-alias-type = identifier / self-type
```
Go to: _[self-type](#user-content-self-type), [identifier](#user-content-identifier)_;
Go to: _[boolean-type](#user-content-boolean-type), [arithmetic-type](#user-content-arithmetic-type), [character-type](#user-content-character-type), [address-type](#user-content-address-type)_;
A tuple type consists of zero, two, or more component types.
@ -1056,32 +1039,68 @@ An array type consists of an element type
and an indication of dimensions.
There is either a single dimension,
or a tuple of one or more dimensions.
Each dimension is either a natural or is unspecified.
<a name="array-type"></a>
```abnf
array-type = "[" type ";" array-dimensions "]"
```
Go to: _[type](#user-content-type), [array-dimensions](#user-content-array-dimensions)_;
Go to: _[array-dimensions](#user-content-array-dimensions), [type](#user-content-type)_;
<a name="array-dimensions"></a>
<a name="array-dimension"></a>
```abnf
array-dimensions = natural
/ "(" natural *( "," natural ) ")"
array-dimension = natural / "_"
```
Go to: _[natural](#user-content-natural)_;
Scalar and the remaining types form all the types.
<a name="array-dimensions"></a>
```abnf
array-dimensions = array-dimension
/ "(" array-dimension *( "," array-dimension ) ")"
```
Go to: _[array-dimension](#user-content-array-dimension)_;
The keyword `Self` denotes the enclosing circuit type.
It is only allowed inside a circuit type declaration.
<a name="self-type"></a>
```abnf
self-type = %s"Self"
```
Circuit types are denoted by identifiers and by `Self`.
Identifiers may also be type aliases;
syntactically (i.e. without a semantic analysis),
they cannot be distinguished from circuit types.
Scalar types, tuple types, array types,
identifiers (which may be circuit types or type aliases),
and the `Self` type
form all the types.
<a name="type"></a>
```abnf
type = scalar-type / tuple-type / array-type / circuit-or-alias-type
type = scalar-type / tuple-type / array-type / identifier / self-type
```
Go to: _[circuit-or-alias-type](#user-content-circuit-or-alias-type), [tuple-type](#user-content-tuple-type), [array-type](#user-content-array-type), [scalar-type](#user-content-scalar-type)_;
Go to: _[array-type](#user-content-array-type), [scalar-type](#user-content-scalar-type), [tuple-type](#user-content-tuple-type), [identifier](#user-content-identifier), [self-type](#user-content-self-type)_;
It is convenient to introduce a rule for types that are
either identifiers or `Self`, as this is used in other rules.
<a name="identifier-or-self-type"></a>
```abnf
identifier-or-self-type = identifier / self-type
```
Go to: _[self-type](#user-content-self-type), [identifier](#user-content-identifier)_;
The lexical grammar given earlier defines product group literals.
@ -1117,7 +1136,7 @@ A literal is either an atomic one or an affine group literal.
literal = atomic-literal / affine-group-literal
```
Go to: _[atomic-literal](#user-content-atomic-literal), [affine-group-literal](#user-content-affine-group-literal)_;
Go to: _[affine-group-literal](#user-content-affine-group-literal), [atomic-literal](#user-content-atomic-literal)_;
The following rule is not directly referenced in the rules for expressions
@ -1130,7 +1149,7 @@ a group literal is either a product group literal or an affine group literal.
group-literal = product-group-literal / affine-group-literal
```
Go to: _[affine-group-literal](#user-content-affine-group-literal), [product-group-literal](#user-content-product-group-literal)_;
Go to: _[product-group-literal](#user-content-product-group-literal), [affine-group-literal](#user-content-affine-group-literal)_;
As often done in grammatical language syntax specifications,
@ -1159,7 +1178,7 @@ primary-expression = identifier
/ circuit-expression
```
Go to: _[identifier](#user-content-identifier), [literal](#user-content-literal), [expression](#user-content-expression), [tuple-expression](#user-content-tuple-expression), [array-expression](#user-content-array-expression), [circuit-expression](#user-content-circuit-expression)_;
Go to: _[tuple-expression](#user-content-tuple-expression), [array-expression](#user-content-array-expression), [identifier](#user-content-identifier), [literal](#user-content-literal), [expression](#user-content-expression), [circuit-expression](#user-content-circuit-expression)_;
Tuple expressions construct tuples.
@ -1220,7 +1239,7 @@ Go to: _[expression](#user-content-expression), [array-dimensions](#user-content
array-construction = array-inline-construction / array-repeat-construction
```
Go to: _[array-repeat-construction](#user-content-array-repeat-construction), [array-inline-construction](#user-content-array-inline-construction)_;
Go to: _[array-inline-construction](#user-content-array-inline-construction), [array-repeat-construction](#user-content-array-repeat-construction)_;
<a name="array-expression"></a>
@ -1242,13 +1261,13 @@ so they are syntactically identical but semantically different.
<a name="circuit-construction"></a>
```abnf
circuit-construction = circuit-or-alias-type "{"
circuit-construction = identifier-or-self-type "{"
circuit-inline-element
*( "," circuit-inline-element ) [ "," ]
"}"
```
Go to: _[circuit-inline-element](#user-content-circuit-inline-element), [circuit-or-alias-type](#user-content-circuit-or-alias-type)_;
Go to: _[identifier-or-self-type](#user-content-identifier-or-self-type), [circuit-inline-element](#user-content-circuit-inline-element)_;
<a name="circuit-inline-element"></a>
@ -1302,12 +1321,12 @@ postfix-expression = primary-expression
/ postfix-expression "." identifier
/ identifier function-arguments
/ postfix-expression "." identifier function-arguments
/ circuit-or-alias-type "::" identifier function-arguments
/ identifier-or-self-type "::" identifier function-arguments
/ postfix-expression "[" expression "]"
/ postfix-expression "[" [expression] ".." [expression] "]"
```
Go to: _[identifier](#user-content-identifier), [postfix-expression](#user-content-postfix-expression), [function-arguments](#user-content-function-arguments), [circuit-or-alias-type](#user-content-circuit-or-alias-type), [primary-expression](#user-content-primary-expression), [natural](#user-content-natural), [expression](#user-content-expression)_;
Go to: _[function-arguments](#user-content-function-arguments), [primary-expression](#user-content-primary-expression), [expression](#user-content-expression), [postfix-expression](#user-content-postfix-expression), [identifier](#user-content-identifier), [natural](#user-content-natural), [identifier-or-self-type](#user-content-identifier-or-self-type)_;
Unary operators have the highest operator precedence.
@ -1335,7 +1354,7 @@ exponential-expression = unary-expression
/ unary-expression "**" exponential-expression
```
Go to: _[unary-expression](#user-content-unary-expression), [exponential-expression](#user-content-exponential-expression)_;
Go to: _[exponential-expression](#user-content-exponential-expression), [unary-expression](#user-content-unary-expression)_;
Next in precedence come multiplication and division, both left-associative.
@ -1347,7 +1366,7 @@ multiplicative-expression = exponential-expression
/ multiplicative-expression "/" exponential-expression
```
Go to: _[exponential-expression](#user-content-exponential-expression), [multiplicative-expression](#user-content-multiplicative-expression)_;
Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [exponential-expression](#user-content-exponential-expression)_;
Then there are addition and subtraction, both left-assocative.
@ -1359,7 +1378,7 @@ additive-expression = multiplicative-expression
/ additive-expression "-" multiplicative-expression
```
Go to: _[multiplicative-expression](#user-content-multiplicative-expression), [additive-expression](#user-content-additive-expression)_;
Go to: _[additive-expression](#user-content-additive-expression), [multiplicative-expression](#user-content-multiplicative-expression)_;
Next in the precedence order are ordering relations.
@ -1398,7 +1417,7 @@ conjunctive-expression = equality-expression
/ conjunctive-expression "&&" equality-expression
```
Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [equality-expression](#user-content-equality-expression)_;
Go to: _[equality-expression](#user-content-equality-expression), [conjunctive-expression](#user-content-conjunctive-expression)_;
Next come disjunctive expressions, left-associative.
@ -1409,7 +1428,7 @@ disjunctive-expression = conjunctive-expression
/ disjunctive-expression "||" conjunctive-expression
```
Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [conjunctive-expression](#user-content-conjunctive-expression)_;
Go to: _[conjunctive-expression](#user-content-conjunctive-expression), [disjunctive-expression](#user-content-disjunctive-expression)_;
Finally we have conditional expressions.
@ -1422,7 +1441,7 @@ conditional-expression = disjunctive-expression
":" conditional-expression
```
Go to: _[disjunctive-expression](#user-content-disjunctive-expression), [expression](#user-content-expression), [conditional-expression](#user-content-conditional-expression)_;
Go to: _[expression](#user-content-expression), [disjunctive-expression](#user-content-disjunctive-expression), [conditional-expression](#user-content-conditional-expression)_;
Those above are all the expressions.
@ -1455,7 +1474,7 @@ statement = expression-statement
/ block
```
Go to: _[assignment-statement](#user-content-assignment-statement), [expression-statement](#user-content-expression-statement), [loop-statement](#user-content-loop-statement), [return-statement](#user-content-return-statement), [console-statement](#user-content-console-statement), [variable-declaration](#user-content-variable-declaration), [conditional-statement](#user-content-conditional-statement), [block](#user-content-block), [constant-declaration](#user-content-constant-declaration)_;
Go to: _[loop-statement](#user-content-loop-statement), [expression-statement](#user-content-expression-statement), [console-statement](#user-content-console-statement), [block](#user-content-block), [return-statement](#user-content-return-statement), [variable-declaration](#user-content-variable-declaration), [constant-declaration](#user-content-constant-declaration), [assignment-statement](#user-content-assignment-statement), [conditional-statement](#user-content-conditional-statement)_;
<a name="block"></a>
@ -1498,7 +1517,7 @@ variable-declaration = %s"let" identifier-or-identifiers [ ":" type ]
"=" expression ";"
```
Go to: _[expression](#user-content-expression), [identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type)_;
Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type), [expression](#user-content-expression)_;
<a name="constant-declaration"></a>
@ -1507,7 +1526,7 @@ constant-declaration = %s"const" identifier-or-identifiers [ ":" type ]
"=" expression ";"
```
Go to: _[identifier-or-identifiers](#user-content-identifier-or-identifiers), [type](#user-content-type), [expression](#user-content-expression)_;
Go to: _[expression](#user-content-expression), [type](#user-content-type), [identifier-or-identifiers](#user-content-identifier-or-identifiers)_;
<a name="identifier-or-identifiers"></a>
@ -1540,7 +1559,7 @@ conditional-statement = branch
/ branch %s"else" conditional-statement
```
Go to: _[branch](#user-content-branch), [block](#user-content-block), [conditional-statement](#user-content-conditional-statement)_;
Go to: _[block](#user-content-block), [conditional-statement](#user-content-conditional-statement), [branch](#user-content-branch)_;
A loop statement implicitly defines a loop variable
@ -1549,10 +1568,11 @@ The body is a block.
<a name="loop-statement"></a>
```abnf
loop-statement = %s"for" identifier %s"in" expression ".." [ "=" ] expression block
loop-statement = %s"for" identifier %s"in" expression ".." [ "=" ] expression
block
```
Go to: _[block](#user-content-block), [identifier](#user-content-identifier), [expression](#user-content-expression)_;
Go to: _[expression](#user-content-expression), [identifier](#user-content-identifier), [block](#user-content-block)_;
An assignment statement is straightforward.
@ -1625,7 +1645,7 @@ Go to: _[string-literal](#user-content-string-literal)_;
print-call = print-function print-arguments
```
Go to: _[print-function](#user-content-print-function), [print-arguments](#user-content-print-arguments)_;
Go to: _[print-arguments](#user-content-print-arguments), [print-function](#user-content-print-function)_;
An annotation consists of an annotation name (which starts with `@`)
@ -1638,7 +1658,7 @@ annotation = annotation-name
[ "(" identifier *( "," identifier ) ")" ]
```
Go to: _[identifier](#user-content-identifier), [annotation-name](#user-content-annotation-name)_;
Go to: _[annotation-name](#user-content-annotation-name), [identifier](#user-content-identifier)_;
A function declaration defines a function.
@ -1655,7 +1675,7 @@ function-declaration = *annotation %s"function" identifier
block
```
Go to: _[block](#user-content-block), [type](#user-content-type), [identifier](#user-content-identifier), [function-parameters](#user-content-function-parameters)_;
Go to: _[identifier](#user-content-identifier), [type](#user-content-type), [block](#user-content-block), [function-parameters](#user-content-function-parameters)_;
<a name="function-parameters"></a>
@ -1665,7 +1685,7 @@ function-parameters = self-parameter
/ function-inputs
```
Go to: _[self-parameter](#user-content-self-parameter), [function-inputs](#user-content-function-inputs)_;
Go to: _[function-inputs](#user-content-function-inputs), [self-parameter](#user-content-self-parameter)_;
<a name="self-parameter"></a>
@ -1756,7 +1776,7 @@ by using an explicit package name before the package path.
import-declaration = %s"import" package-name "." package-path ";"
```
Go to: _[package-path](#user-content-package-path), [package-name](#user-content-package-name)_;
Go to: _[package-name](#user-content-package-name), [package-path](#user-content-package-path)_;
<a name="package-path"></a>
@ -1767,19 +1787,17 @@ package-path = "*"
/ "(" package-path *( "," package-path ) [","] ")"
```
Go to: _[package-name](#user-content-package-name), [identifier](#user-content-identifier), [package-path](#user-content-package-path)_;
Go to: _[package-path](#user-content-package-path), [identifier](#user-content-identifier), [package-name](#user-content-package-name)_;
A type declaration consists of the `type` keyword
followed by an identifier and a type that the alias
would refer to.
A type alias declaration defines an identifier to stand for a type.
<a name="type-alias-declaration"></a>
```abnf
type-alias-declaration = %s"type" identifier "=" type ";"
```
Go to: _[type](#user-content-type), [identifier](#user-content-identifier)_;
Go to: _[identifier](#user-content-identifier), [type](#user-content-type)_;
Finally, we define a file as a sequence of zero or more declarations.
@ -1795,7 +1813,7 @@ declaration = import-declaration
/ type-alias-declaration
```
Go to: _[import-declaration](#user-content-import-declaration), [circuit-declaration](#user-content-circuit-declaration), [constant-declaration](#user-content-constant-declaration), [type-alias-declaration](#user-content-type-alias-declaration), [function-declaration](#user-content-function-declaration)_;
Go to: _[circuit-declaration](#user-content-circuit-declaration), [import-declaration](#user-content-import-declaration), [function-declaration](#user-content-function-declaration), [constant-declaration](#user-content-constant-declaration), [type-alias-declaration](#user-content-type-alias-declaration)_;
<a name="file"></a>

View File

@ -659,14 +659,6 @@ character-type = %s"char"
scalar-type = boolean-type / arithmetic-type / address-type / character-type
; Circuit types are denoted by identifiers and the keyword `Self`.
; The latter is only allowed inside a circuit definition,
; to denote the circuit being defined.
self-type = %s"Self"
circuit-or-alias-type = identifier / self-type
; A tuple type consists of zero, two, or more component types.
tuple-type = "(" [ type 1*( "," type ) ] ")"
@ -675,6 +667,7 @@ tuple-type = "(" [ type 1*( "," type ) ] ")"
; and an indication of dimensions.
; There is either a single dimension,
; or a tuple of one or more dimensions.
; Each dimension is either a natural or is unspecified.
array-type = "[" type ";" array-dimensions "]"
@ -683,9 +676,27 @@ array-dimension = natural / "_"
array-dimensions = array-dimension
/ "(" array-dimension *( "," array-dimension ) ")"
; Scalar and the remaining types form all the types.
; The keyword `Self` denotes the enclosing circuit type.
; It is only allowed inside a circuit type declaration.
type = scalar-type / tuple-type / array-type / circuit-or-alias-type
self-type = %s"Self"
; Circuit types are denoted by identifiers and by `Self`.
; Identifiers may also be type aliases;
; syntactically (i.e. without a semantic analysis),
; they cannot be distinguished from circuit types.
; Scalar types, tuple types, array types,
; identifiers (which may be circuit types or type aliases),
; and the `Self` type
; form all the types.
type = scalar-type / tuple-type / array-type / identifier / self-type
; It is convenient to introduce a rule for types that are
; either identifiers or `Self`, as this is used in other rules.
identifier-or-self-type = identifier / self-type
; The lexical grammar given earlier defines product group literals.
; The other kind of group literal is a pair of integer coordinates,
@ -771,7 +782,7 @@ array-expression = array-construction
; while the right one denotes an expression (a variable),
; so they are syntactically identical but semantically different.
circuit-construction = circuit-or-alias-type "{"
circuit-construction = identifier-or-self-type "{"
circuit-inline-element
*( "," circuit-inline-element ) [ "," ]
"}"
@ -807,7 +818,7 @@ postfix-expression = primary-expression
/ postfix-expression "." identifier
/ identifier function-arguments
/ postfix-expression "." identifier function-arguments
/ circuit-or-alias-type "::" identifier function-arguments
/ identifier-or-self-type "::" identifier function-arguments
/ postfix-expression "[" expression "]"
/ postfix-expression "[" [expression] ".." [expression] "]"
@ -937,7 +948,8 @@ conditional-statement = branch
; that goes from a starting value (inclusive) to an ending value (exclusive).
; The body is a block.
loop-statement = %s"for" identifier %s"in" expression ".." [ "=" ] expression block
loop-statement = %s"for" identifier %s"in" expression ".." [ "=" ] expression
block
; An assignment statement is straightforward.
; Based on the operator, the assignment may be simple (i.e. `=`)
@ -1049,9 +1061,7 @@ package-path = "*"
/ package-name "." package-path
/ "(" package-path *( "," package-path ) [","] ")"
; A type declaration consists of the `type` keyword
; followed by an identifier and a type that the alias
; would refer to.
; A type alias declaration defines an identifier to stand for a type.
type-alias-declaration = %s"type" identifier "=" type ";"

View File

@ -91,7 +91,7 @@ impl ParserContext {
(Type::SelfType, token.span)
} else if let Some(ident) = self.eat_identifier() {
let span = ident.span.clone();
(Type::CircuitOrAlias(ident), span)
(Type::Identifier(ident), span)
} else if let Some(token) = self.eat(Token::LeftParen) {
let mut types = Vec::new();
let end_span;

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: a4a3b4b30742544a6dae3d76794504173c1cc64f217bd3feda033ce51512a670
imports_resolved_ast: a4a3b4b30742544a6dae3d76794504173c1cc64f217bd3feda033ce51512a670
canonicalized_ast: a4a3b4b30742544a6dae3d76794504173c1cc64f217bd3feda033ce51512a670
initial_ast: 6349e2684562bad873bcf643e01eeb02039295bd41e2df77f1fefc7bb3f2d3bb
imports_resolved_ast: 6349e2684562bad873bcf643e01eeb02039295bd41e2df77f1fefc7bb3f2d3bb
canonicalized_ast: 6349e2684562bad873bcf643e01eeb02039295bd41e2df77f1fefc7bb3f2d3bb
type_inferenced_ast: 508686ddeb2f8fad60d9ad58639b5a761e6c5f5b61e105803eb8a98d8065a2ad

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: d83b33119db295fa2ed7795c8e17d4073cabba5e90e9438cd53f3a9a77585f19
imports_resolved_ast: d83b33119db295fa2ed7795c8e17d4073cabba5e90e9438cd53f3a9a77585f19
canonicalized_ast: d83b33119db295fa2ed7795c8e17d4073cabba5e90e9438cd53f3a9a77585f19
type_inferenced_ast: 77be8ec74bc15f2a45e8bf29e7973bc0c721008fe5508dcc6d02b91aae3d84ee
initial_ast: 9f78c996da10363fb594947ca29fef29e35a7032761ce87f69f3ae454650d47e
imports_resolved_ast: 9f78c996da10363fb594947ca29fef29e35a7032761ce87f69f3ae454650d47e
canonicalized_ast: 9f78c996da10363fb594947ca29fef29e35a7032761ce87f69f3ae454650d47e
type_inferenced_ast: 103314a18ce6036da1ab4cc32c025b694cf799492460ab9553dfbd5232544a89

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: d9b0b6772317f0e2d1042dba26c19b4eb71a7e902c643cbeb0a4f62630f0f1bc
imports_resolved_ast: d9b0b6772317f0e2d1042dba26c19b4eb71a7e902c643cbeb0a4f62630f0f1bc
canonicalized_ast: d9b0b6772317f0e2d1042dba26c19b4eb71a7e902c643cbeb0a4f62630f0f1bc
type_inferenced_ast: e384fbed9e161b04c6c9e85f45788e5047385f289ef89d20fdacee00a8fb3e5c
initial_ast: ee817c17e6bef3b458e14d3a81c087ed6a75c4554bc70b62466e8d8e43ff1b5e
imports_resolved_ast: ee817c17e6bef3b458e14d3a81c087ed6a75c4554bc70b62466e8d8e43ff1b5e
canonicalized_ast: ee817c17e6bef3b458e14d3a81c087ed6a75c4554bc70b62466e8d8e43ff1b5e
type_inferenced_ast: b15c7e773ebb56e339f750401241e38aab4ab8950c20a70acc293afc1b91d917

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 7feac3e33e75789d3b532a7cc857f324cd7abed380d578791803b3162edcfdec
imports_resolved_ast: 7feac3e33e75789d3b532a7cc857f324cd7abed380d578791803b3162edcfdec
canonicalized_ast: 7feac3e33e75789d3b532a7cc857f324cd7abed380d578791803b3162edcfdec
initial_ast: 8d5ed3110bc3a61ddee37408133fcc1f77209b65bb83d230729203009e093f40
imports_resolved_ast: 8d5ed3110bc3a61ddee37408133fcc1f77209b65bb83d230729203009e093f40
canonicalized_ast: 8d5ed3110bc3a61ddee37408133fcc1f77209b65bb83d230729203009e093f40
type_inferenced_ast: bc54ad21e90ab297b40ff570dfc379cbca61fdc9e20bd6899f4b964f726954b0

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 671704ed30a8c68ebffe2a58ff4799f626badf975d2d0dded3b06f5264e5c0db
imports_resolved_ast: 671704ed30a8c68ebffe2a58ff4799f626badf975d2d0dded3b06f5264e5c0db
canonicalized_ast: 671704ed30a8c68ebffe2a58ff4799f626badf975d2d0dded3b06f5264e5c0db
type_inferenced_ast: eb525f7c227207a1037b96838d2f0cf597968c14117b3fae30564f3cd5a3a27b
initial_ast: f7b2eb89c51644dc8596988bcc66fbfe471489887c6f46b78ca417746c7ef442
imports_resolved_ast: f7b2eb89c51644dc8596988bcc66fbfe471489887c6f46b78ca417746c7ef442
canonicalized_ast: f7b2eb89c51644dc8596988bcc66fbfe471489887c6f46b78ca417746c7ef442
type_inferenced_ast: f24ef5063928ee7998b53e5e66064c56c01bd99d55b736309d3a1d11ff2fec05

View File

@ -1,5 +0,0 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373047]: a function input cannot be named `x` as a alias with that name already exists in this scope\n --> compiler-test:5:15\n |\n 5 | function main(x: u32, y: bool) -> bool {\n | ^"

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: cd2e85ff29ee11d30e73dbba0a612223a8a26dff125069ad7ac05697fd4c9829
imports_resolved_ast: cd2e85ff29ee11d30e73dbba0a612223a8a26dff125069ad7ac05697fd4c9829
canonicalized_ast: cd2e85ff29ee11d30e73dbba0a612223a8a26dff125069ad7ac05697fd4c9829
initial_ast: 66ead06ceac4fea6a24fe071a955986722a53975fa98d2ad2909a83fa8ba8525
imports_resolved_ast: 66ead06ceac4fea6a24fe071a955986722a53975fa98d2ad2909a83fa8ba8525
canonicalized_ast: 66ead06ceac4fea6a24fe071a955986722a53975fa98d2ad2909a83fa8ba8525
type_inferenced_ast: 1e73226b2cbbd5c7a36ffe70b778e0e544976d2e09a1f0ba3f2b486d1b604d58

View File

@ -1,5 +0,0 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [EASG0373047]: a function input cannot be named `int` as a alias with that name already exists in this scope\n --> compiler-test:6:9\n |\n 6 | let int: int = 1u32;\n | ^^^"

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 843884ddf198fe566cea0f8e84a2902f720d6211c9d8bad98299eea4da846870
imports_resolved_ast: 843884ddf198fe566cea0f8e84a2902f720d6211c9d8bad98299eea4da846870
canonicalized_ast: c30721e60523bc31af9a9bf342d9b89bf92a26e3886394cc0c1a574560715bdf
type_inferenced_ast: c37f209961a9acff1d942af1e4a9a332123676f2bc581ca94604314f9d738a1e
type_inferenced_ast: baed608da257be0625cd54a796c2f89e9aec8b1ff60f23c7657a0c4fc260e1d1

View File

@ -25,4 +25,4 @@ outputs:
initial_ast: 4e74124bc410534941ef9b79ffb64656d14e145b5a79fbd14419c1aef2f0ef69
imports_resolved_ast: 4e74124bc410534941ef9b79ffb64656d14e145b5a79fbd14419c1aef2f0ef69
canonicalized_ast: 4e74124bc410534941ef9b79ffb64656d14e145b5a79fbd14419c1aef2f0ef69
type_inferenced_ast: f5cb6326028b3cf9187889be6ac5ed5bd095a570d45ae63c7285a09366fc6803
type_inferenced_ast: de80815f88fb65efa62ce7f5fa23c6fc4f1bbdf601954e94c1212c4eabbee1cb

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 1695abb58931812bfe65ffdb967c9e8e36abbab771bfd8a20e289e3e1b102b5a
imports_resolved_ast: 1695abb58931812bfe65ffdb967c9e8e36abbab771bfd8a20e289e3e1b102b5a
canonicalized_ast: 637eaabe62c318b0c9f9d6d26936c11aa8804022866ce356e14dc02e29a34251
type_inferenced_ast: 1540899195a176d1b1d0e1d886a671f07f063dd10fea15f853e67ffcfc0ae9ce
initial_ast: 0e8ea2eb2de2ad93883ced129ab7c42674fd476d94ede483f5ea042f8386b730
imports_resolved_ast: 0e8ea2eb2de2ad93883ced129ab7c42674fd476d94ede483f5ea042f8386b730
canonicalized_ast: 529ba1d5564ef0c1752343e3e6e8b181f13bec0620c4ecbe23080ef4a080cb2b
type_inferenced_ast: b4d3305f7179dfc2a7a330e538a41e3cdf51f12e4a6545cd57ff9a2e5a9d1db0

View File

@ -103,4 +103,4 @@ outputs:
initial_ast: 0c2aeb5b47fc21f5aded4e3aebcdf55eb98c10c6b51a2a6dcb98490a96da0c97
imports_resolved_ast: 0c2aeb5b47fc21f5aded4e3aebcdf55eb98c10c6b51a2a6dcb98490a96da0c97
canonicalized_ast: 0c2aeb5b47fc21f5aded4e3aebcdf55eb98c10c6b51a2a6dcb98490a96da0c97
type_inferenced_ast: 84977d828c2988392d85d4156d34d168a3265aca3c3516b3ddb974d3d9eee2dc
type_inferenced_ast: e9c5fc64aad2390305671ffbe316eee04d5fca7a6f09dcc8c8a69c38db8b3a62

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 8ccdbe000ca6a2ae3b7cf8601d5b6a922106181fe3f1b8aede16c5661a816b93
imports_resolved_ast: 8ccdbe000ca6a2ae3b7cf8601d5b6a922106181fe3f1b8aede16c5661a816b93
canonicalized_ast: 551e7de9ff8d1391a435861819576c9ac1a0ff93818c7a907830be890e27311f
type_inferenced_ast: b83403b86ddd7a10d070a4537a95ac03075e292d3004cdb667564b630dcae805
initial_ast: d8ff1c8c84bc93bbd4e712dde7eb3c9dbe433199f5902b6dc3329cf3ca607811
imports_resolved_ast: d8ff1c8c84bc93bbd4e712dde7eb3c9dbe433199f5902b6dc3329cf3ca607811
canonicalized_ast: 9ef4d52afc2cbbcaa7759af48d1603feb28287d619293135a7856625a37299f7
type_inferenced_ast: f3a91e1cd91f60c94ffe809369eeecb2f22996b6f14c1589a5c7a825519a6b1e

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 50c0f7261d879373f4e01ec3d140a2067ca4e78622c8340e8312d717f6effb05
imports_resolved_ast: 50c0f7261d879373f4e01ec3d140a2067ca4e78622c8340e8312d717f6effb05
canonicalized_ast: 50c0f7261d879373f4e01ec3d140a2067ca4e78622c8340e8312d717f6effb05
type_inferenced_ast: 161edd5d1900f2902bd8cc972308ce7fb0afe7c6cf64ab7cfe952c3f1b3189c0
type_inferenced_ast: 68174a753a3191ea961db29f62b6557f410ee33c2cad28c43a5098bb6cb230f2

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: bfd7751e8ea64c6d41af36d968f194a18a5411ac71932a67766f40448ce755f5
imports_resolved_ast: bfd7751e8ea64c6d41af36d968f194a18a5411ac71932a67766f40448ce755f5
canonicalized_ast: bfd7751e8ea64c6d41af36d968f194a18a5411ac71932a67766f40448ce755f5
type_inferenced_ast: 910b51f962861da6011f214a5379bc9296034e3fecda347b17c7db97df833a25
type_inferenced_ast: c6ca022e97bef335bf6df235875d507240eb48ea28f6504cc17c3d09820430f9

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: d8a66347f480161a2215c92d2cf6ded2d0b49fd76b7eb0036d4fa33de371925a
imports_resolved_ast: d8a66347f480161a2215c92d2cf6ded2d0b49fd76b7eb0036d4fa33de371925a
canonicalized_ast: d8a66347f480161a2215c92d2cf6ded2d0b49fd76b7eb0036d4fa33de371925a
type_inferenced_ast: d5bb87130d78bb39fa948ce868999184f90c78ada176cf08c49051517de3351c
type_inferenced_ast: cb82c955829007961356ca2760b6ca84e2ea321cd640e87d4a51fd3ba65eb7a7

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: c40a1d60f872fdb03ab7379a3abf43439a100b8f1546b76ffeac60c8739e0d68
imports_resolved_ast: c40a1d60f872fdb03ab7379a3abf43439a100b8f1546b76ffeac60c8739e0d68
canonicalized_ast: c40a1d60f872fdb03ab7379a3abf43439a100b8f1546b76ffeac60c8739e0d68
type_inferenced_ast: 3d56ffd95d1b84970e24f10a48f52053717876f062db72d8be93f413f7b2c9a3
type_inferenced_ast: 2221472ded58b4a6c77545040ca32138d68eb6f2c3e47b830317872f045f91f8

View File

@ -18,5 +18,5 @@ outputs:
value: "true"
initial_ast: cf642f2f983cd8bcd6cbca2d2920f5234d79375601c1da3c06f97b6185a5629d
imports_resolved_ast: cf642f2f983cd8bcd6cbca2d2920f5234d79375601c1da3c06f97b6185a5629d
canonicalized_ast: f99560385252ad2965e39b19402e7c56db402458206187eeb54adc26effd9bb5
type_inferenced_ast: c7c5cd5ed24fd3967f19a5ad895aeb7778b3dfadc7965c3f5bc1d44c61448083
canonicalized_ast: de45d7a621a1309ca9ae0dd11f4a99e8ff1e0b92c9f990d2f72a6c43067a7611
type_inferenced_ast: 690a93dcec9c31c26b52ca234ce8e07067649c038e47fd8b7eeef9e36dddf05b

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 5273a592b167cfe040b2bca7337521084d7a6640651bca584545e9eeb2e4fa88
imports_resolved_ast: 5273a592b167cfe040b2bca7337521084d7a6640651bca584545e9eeb2e4fa88
canonicalized_ast: 5273a592b167cfe040b2bca7337521084d7a6640651bca584545e9eeb2e4fa88
type_inferenced_ast: 6d1bef6ecbba4533266f9478b06e52acc56f04850e99a658abffe39e7e463cdf
type_inferenced_ast: ee2152aedd637adcfdd84540bfd8814c65cc8552c0bae80a0176b91d70b1266e

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 241f1a42877b012b2e2062cefbd83523a5c719557cb422cf1fbd7efb0f7b1796
imports_resolved_ast: 241f1a42877b012b2e2062cefbd83523a5c719557cb422cf1fbd7efb0f7b1796
canonicalized_ast: 241f1a42877b012b2e2062cefbd83523a5c719557cb422cf1fbd7efb0f7b1796
type_inferenced_ast: 2982ee6fda2fcbd00f64d2c0c75ccacf58ab05961f85e9a64cc0ddec12bb5209
type_inferenced_ast: e063513fb0d009c0cadd36cab9feb4327528bbba45087d7a65e0e97fcd54bb7a

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: cf41b78f9435c6555014db8aeebe662556f4f8547ee0f3a204d6f522fcf72644
imports_resolved_ast: cf41b78f9435c6555014db8aeebe662556f4f8547ee0f3a204d6f522fcf72644
canonicalized_ast: cf41b78f9435c6555014db8aeebe662556f4f8547ee0f3a204d6f522fcf72644
type_inferenced_ast: d947fa6d8fa1b34cc9822ade386062dbd6ebc2cb5987479d4263bcfa554586cd
type_inferenced_ast: 2fbe148dcadf6f460f64824e311f1f061265dc81e2eaff555987dbf55094b3a4

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 622baae85ab7776fc38cff17465e8e0dbcdb98f4ba74e734ca494b696cea8ccd
imports_resolved_ast: 622baae85ab7776fc38cff17465e8e0dbcdb98f4ba74e734ca494b696cea8ccd
canonicalized_ast: 622baae85ab7776fc38cff17465e8e0dbcdb98f4ba74e734ca494b696cea8ccd
type_inferenced_ast: c604cecb0efbae6b8ea3d69909c5decbb06d6a2e95ff67661f5936ef8fd951a5
type_inferenced_ast: f97b773504a230c42546d6a565b970fbf51ec293c15ee58d4f9dfa40b7a4a988

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: ba91ea172a2f753bf4a338f29fff05c358d4dc0cb1c2ef461d492ee4fe2a1114
imports_resolved_ast: ba91ea172a2f753bf4a338f29fff05c358d4dc0cb1c2ef461d492ee4fe2a1114
canonicalized_ast: 8d1beaecc785aa79a5a6bec47cf10426b9d3d87ccc15c359f12c7d3ee2a95561
type_inferenced_ast: 520a83004a666274e62958b6e2025d11ed5e24d888b6bc0ded6d01ee9a3bc634
type_inferenced_ast: d69ef792ee9b73a3d486535216ade98bd500aff7061e5b3cb48e5f1ffd519286

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: fe7ca41c29d33107a4316b9c6788898217129937cbf1de0f2ea7566a360245f0
imports_resolved_ast: fe7ca41c29d33107a4316b9c6788898217129937cbf1de0f2ea7566a360245f0
canonicalized_ast: d2b30a9485e7166a0efde9d179432e481a4d40540e1b3eeec043b84d993e66df
type_inferenced_ast: 2c666d0e878095617bc562aa74de4fe069401b4a80ba8dba28a47a789f517ab5
type_inferenced_ast: 7f279d6a24e597f0d1e6dbc5d26db3bc0ac6dc8520b7b485f296824c2e872a0e

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 659e5fcdd16752c6e3504f821a5afd6f0756bd6b8641f127ba049c2a4c83a088
imports_resolved_ast: 659e5fcdd16752c6e3504f821a5afd6f0756bd6b8641f127ba049c2a4c83a088
canonicalized_ast: 8cf6113b757cfeee53554c67dd3f380f0f417032b8835259bf30076b19349f61
type_inferenced_ast: d4106eb006385de5bf2a56a1ebaa25a65b048f77dda6fb9585c86a9260073585
type_inferenced_ast: 63445b0618aa26ad71f316dea01a0558be3462295c4ef7ddcc042a6098e80725

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 8c4a98dec3d2e9e826e3419c91a251e821861a146325b025c52ff15b5edefe1c
imports_resolved_ast: 8c4a98dec3d2e9e826e3419c91a251e821861a146325b025c52ff15b5edefe1c
canonicalized_ast: 8c4a98dec3d2e9e826e3419c91a251e821861a146325b025c52ff15b5edefe1c
type_inferenced_ast: 2497671092bacab8cb5d75177298a700100bfa8412a48a7115d178e5d9816a6b
type_inferenced_ast: a88491df0bd761c2c92882182087308683df773c06b6337d47e47658024ba6ea

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: 1f7de14429213b2b3b564d664c33e9cea134e1a157b861a1cf0ea1abc90b32f6
imports_resolved_ast: 1f7de14429213b2b3b564d664c33e9cea134e1a157b861a1cf0ea1abc90b32f6
canonicalized_ast: 94752f37ca7553267f341d2f96e657eb2fe6b5e403a4d3fb7d66d1662b81eb00
type_inferenced_ast: e675411217f3465fdc23bab3c2f50c2264452d198ab3dd2e8059e546e54312a4
initial_ast: 842ec0aa120289fc341e19deefa59c7f78af032b1221b749323e0e4b6ce9023d
imports_resolved_ast: 842ec0aa120289fc341e19deefa59c7f78af032b1221b749323e0e4b6ce9023d
canonicalized_ast: c554b4086bcc2a245ee45c1a7ee7879c23dfab6872c8f0254bd258f1d78854b5
type_inferenced_ast: 8aca5d3beb3f7988b97d7ee3ed5f5376e508e35b687bc70cc402824e3740afc9

View File

@ -18,5 +18,5 @@ outputs:
value: "true"
initial_ast: c341e62f8a3940ddc9527bcd01c814f8d496a1f02ca903b080b6228d155af02b
imports_resolved_ast: c341e62f8a3940ddc9527bcd01c814f8d496a1f02ca903b080b6228d155af02b
canonicalized_ast: 60cd9f24460e06522814151af817c9d394c779477091aab2c77c77dfe228b611
type_inferenced_ast: 876f075ed034c8914b9f74f46f07bd6c2ed3e7d7f1ffb15e756da10e9ec9abf8
canonicalized_ast: 3f982b126b30b7d4e6f69d186eae87e539ac99c186e3ffc95e101996c447aac6
type_inferenced_ast: ca39452d2a0bfc4763004f6422de9c969c90bef10f6ec1ce47d71ce6fbf14d60

View File

@ -18,5 +18,5 @@ outputs:
value: "true"
initial_ast: 5da09287f1d3a5e4ab57f8da2c8094df25c3b35614791e2f6e84a77b609f29b0
imports_resolved_ast: 5da09287f1d3a5e4ab57f8da2c8094df25c3b35614791e2f6e84a77b609f29b0
canonicalized_ast: de5114bff3425e0c67e9e70e3a0d02bdf2d6c3ed9108dac43a00b79d4db9b3d2
type_inferenced_ast: 9a6f5ee1784a1af0a04736e1b3bc886107bbddc5d45bbabd59812d083acacdea
canonicalized_ast: ef7bf4fbec528e16a88b50e4c5b96f9e16a136fb06b9d7ba145641e22382e166
type_inferenced_ast: cfec0af03e9a908d876dd84a977fbccb7ddbda93e4f26b2bb7c1e7349ef41c3f

View File

@ -18,5 +18,5 @@ outputs:
value: "true"
initial_ast: 1dce719e850f6ca6a091fea163d5d6bb069bcdafeeed0a10fb332ba8837e6e5c
imports_resolved_ast: 1dce719e850f6ca6a091fea163d5d6bb069bcdafeeed0a10fb332ba8837e6e5c
canonicalized_ast: 3bd96f7e9530f426db4a2e12d5a93a5ebcafedbcb7b4549d08ad387fa15918d9
type_inferenced_ast: 6bbb246f57aa199b9ef31b61b6e858004617455efe22393892bf0c22f552d69a
canonicalized_ast: c2e6a47b169e35f9d0eeb382b9ad3fbfb474dcfcce36f518a615bedd50f168dc
type_inferenced_ast: ada2285ca841403ea8f299de603e6f83f001aa7c59f0ccdb798cf3ed874cbe1f

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: c2f6d0da67de691b14cffbdbe20eba613f2ea274c45aba4347045da2446b6af6
imports_resolved_ast: c2f6d0da67de691b14cffbdbe20eba613f2ea274c45aba4347045da2446b6af6
canonicalized_ast: c2f6d0da67de691b14cffbdbe20eba613f2ea274c45aba4347045da2446b6af6
type_inferenced_ast: 3bf3d109f59519ecbfd601c36a8cb89cfb36e1ace395e361860023b8f93fc220
type_inferenced_ast: 66f38055929362798774a530c32dd375c979368f2ed3c7b0345dd8ecfefe3ea7

View File

@ -1,21 +0,0 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: input/dummy.in
output:
registers:
r0:
type: bool
value: "true"
initial_ast: 80d3dbfdeb9d6fb6e9ba17ba028bd2bf71014b4353f34db9d69a66ee1d0914cf
canonicalized_ast: 80d3dbfdeb9d6fb6e9ba17ba028bd2bf71014b4353f34db9d69a66ee1d0914cf
type_inferenced_ast: bbad9d7593fb1aa2bcc25f2f2625ace659e18f293af35082ad39b1e3cd71e8b5

View File

@ -22,4 +22,4 @@ outputs:
initial_ast: f8b2853c4b5db8f5e8402455ceae54d8ae421c4b950d15fc88fe9f9c9a9701b8
imports_resolved_ast: f8b2853c4b5db8f5e8402455ceae54d8ae421c4b950d15fc88fe9f9c9a9701b8
canonicalized_ast: f8b2853c4b5db8f5e8402455ceae54d8ae421c4b950d15fc88fe9f9c9a9701b8
type_inferenced_ast: 8a3cbc4e3f51c432179167c22247efecc49afe8990c5b2e5a1eb757d0f5adad9
type_inferenced_ast: 52232bc9ef6145283b66f274ab534f35ad5cbf76ed6396c34cf0d6bf59b0797c

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: d53a0267c4afe271c6488aeda9910433e3a947d96530ea1286eba511e6e8f17e
imports_resolved_ast: d53a0267c4afe271c6488aeda9910433e3a947d96530ea1286eba511e6e8f17e
canonicalized_ast: 86bc6722c866a18e2b4d022e67c82dfa0f20f1b4d86d2869f6267010ef45c0c6
type_inferenced_ast: 57202f3b3a4808ce13cce466b6e7a6b153c1950e6af6fcbe68bf04a4d95476f1
type_inferenced_ast: 0c7674288e3db92d39726e8d2964f7c03eeb8e27ec54d0cd558b20e976a48686

View File

@ -16,7 +16,7 @@ outputs:
r0:
type: bool
value: "true"
initial_ast: af29b4526e16fa59b0c58106f77bc4453a845480a04c82a321157d667c6d07c9
imports_resolved_ast: ecd27f76f14e754b00f5c1b4d3f14092e76775865933668c7072885b77067e86
canonicalized_ast: dedb5d6243d79db6a186b4cc8bfbf652c8dcf982c4fc8a32b4bf51e8cf689253
type_inferenced_ast: 316391d0eec112e0fea34a14f2388c320f99d5da63211aea90cd7ca92eb81cf9
initial_ast: 44686de6ff7da19563c7435f977498fa070fe70394604f00891ac56919b49fc9
imports_resolved_ast: 04931e9a33306909e081ee99676f78fea07a00a88fddea1b41b7f49fe01b8b74
canonicalized_ast: 54f102c09881160287bb9ddd18a8b827b1fbd7a5e7f65a6bf930c2e1d289895a
type_inferenced_ast: 72cfbfa0e53d0f93ef984949371141b4ed9adb0b4663775a0a973cd04681a826

View File

@ -17,6 +17,6 @@ outputs:
type: bool
value: "true"
initial_ast: ae6826642faa492e34507695dbd11e5b44c319aecb0b1e78b29ce03ae446d907
imports_resolved_ast: 38cdae0ceb9feea0550ae88df86e9d0676c592fdc7a0a37f56da8c2d62dd3199
canonicalized_ast: 38cdae0ceb9feea0550ae88df86e9d0676c592fdc7a0a37f56da8c2d62dd3199
type_inferenced_ast: 93e0e825fc6daeabfd3891441979f4575d87a019996de7ce43241d1b535c5604
imports_resolved_ast: 20295c05b1768223eff4982abafe03e060196400ccf046df15a48a0a87c5fcdb
canonicalized_ast: 20295c05b1768223eff4982abafe03e060196400ccf046df15a48a0a87c5fcdb
type_inferenced_ast: edfcbd28230c0bae0b1e7fd32d8e72898368bc5ea7fe58cc285bb5c7e0588d24

View File

@ -1,5 +0,0 @@
---
namespace: Compile
expectation: Fail
outputs:
- aborting due to syntax error

View File

@ -1,5 +0,0 @@
---
namespace: Compile
expectation: Fail
outputs:
- aborting due to syntax error

View File

@ -1,5 +0,0 @@
---
namespace: Compile
expectation: Fail
outputs:
- " --> compiler-test:3:15\n |\n 3 | function main(a: u32) {\n | ^\n |\n = expected data type `u32`, found `u8`"

View File

@ -1,5 +0,0 @@
---
namespace: Compile
expectation: Fail
outputs:
- aborting due to syntax error

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: dc7f40a1cfc4daa659784bf538f1273145b430875116ef1aad7fd778dcb5f736
imports_resolved_ast: dc7f40a1cfc4daa659784bf538f1273145b430875116ef1aad7fd778dcb5f736
canonicalized_ast: dc7f40a1cfc4daa659784bf538f1273145b430875116ef1aad7fd778dcb5f736
type_inferenced_ast: f86a95c627e69d54fd6f1f651eda77cfc1ac1fab33b1ef8bbe5bf511a8c4beb7
type_inferenced_ast: f1d1997e4d2a975664689164c1113ab8ac1e0933910410324aeb204a72da3b12

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 6b051c3f9ce82efb30d3ba89764cc9c2607a126cb0cede72ad55ecda6c9d996d
imports_resolved_ast: 6b051c3f9ce82efb30d3ba89764cc9c2607a126cb0cede72ad55ecda6c9d996d
canonicalized_ast: 6b051c3f9ce82efb30d3ba89764cc9c2607a126cb0cede72ad55ecda6c9d996d
type_inferenced_ast: 3c04200d560739b0d551204b65e56abc11f26843b99aa0361362f61f0d6a3328
type_inferenced_ast: 945f580a5c7a138000c0163b32e004c52e048ddf2166d0c9cfd67cd9485dc886

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 6fce132965ff40126f6175d2abe5b8598004e90cdb29c4707f7c63dbe1093474
imports_resolved_ast: 6fce132965ff40126f6175d2abe5b8598004e90cdb29c4707f7c63dbe1093474
canonicalized_ast: 6fce132965ff40126f6175d2abe5b8598004e90cdb29c4707f7c63dbe1093474
type_inferenced_ast: 75cff35e24806b8a66431668c319a96e95f5106a8fe513eb53abb264beab4390
type_inferenced_ast: e79e7662148ee3db46c9d52b751fb80a13213b22065e4a5008a7443ae85419e0

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: a155141331da2d7bdaa11ae738d6ca2e1d62d875c872b8b8213184d989cc8baa
imports_resolved_ast: a155141331da2d7bdaa11ae738d6ca2e1d62d875c872b8b8213184d989cc8baa
canonicalized_ast: a155141331da2d7bdaa11ae738d6ca2e1d62d875c872b8b8213184d989cc8baa
type_inferenced_ast: b4969327ce0ee30ab1526ce3b2479a7bf6efa38cb9616477f854cd28b1faf61a
type_inferenced_ast: 096e1372719be459b86ad5dea6e2e62f3afc350a204c382d4bebb835fa2dc615

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 71448f3f5387cd67a8d8c0b974fa93cf81cdfb72ae0d8f9499c9c5e478a0d15b
imports_resolved_ast: 71448f3f5387cd67a8d8c0b974fa93cf81cdfb72ae0d8f9499c9c5e478a0d15b
canonicalized_ast: 16d4030e454d8c83d2073afaaa7e8fa1eb40d36026909144db29d311ab005f46
type_inferenced_ast: a446d016451281bab9b21f8a86250b4a3fd8a9b6f917e855e5dae816362c8925
type_inferenced_ast: 2d0489a411d4336c01958f074b96957f3f8ae682b0046ffadf9cbddf66f7f168

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 83da7a1bf2887678937835ac77b33a0e21dd3b04d5739146f16a559b8dc3c6ab
imports_resolved_ast: 83da7a1bf2887678937835ac77b33a0e21dd3b04d5739146f16a559b8dc3c6ab
canonicalized_ast: 83da7a1bf2887678937835ac77b33a0e21dd3b04d5739146f16a559b8dc3c6ab
type_inferenced_ast: bd7710479d2a5bb2da060358fc13379dc1d7e334ead42519315bce0cd0db30c0
type_inferenced_ast: b0d9f15a133962134f094c0aa682d7f2f77085b9cad845b8af05cf48e9b7b9ca

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 108be85422345d78a93d2e36e633c3a15a1465e7c868f65e2925a47e0b5f691a
imports_resolved_ast: 108be85422345d78a93d2e36e633c3a15a1465e7c868f65e2925a47e0b5f691a
canonicalized_ast: d986fa603a5031dbd5034507d05df038fe99f60f603f7ca4b2d2c8ac2b409e7a
type_inferenced_ast: c95a6049c552c5b018f423fc1999b433cf94429c6edc32e2b55d326b78e36812
type_inferenced_ast: 2f852c7591f1790075fe73a53f9b2ceb3bca69a8cc7ef1d27d70e5f53e8b144f

View File

@ -1,21 +0,0 @@
---
namespace: Compile
expectation: Pass
outputs:
- circuit:
num_public_variables: 0
num_private_variables: 1
num_constraints: 1
at: 042610d0fd1fe6d6ac112138f8755752f44c7d2a00f1b5960574d6da5cda393f
bt: e97756698880ab7555a959a5fb5c6b4e15bd64612aa677adbfe2d0bd91f0a83c
ct: cf1cbb66a638b4860a516671fb74850e6ccf787fe6c4c8d29e9c04efe880bd05
output:
- input_file: inputs/dummy.in
output:
registers:
r0:
type: bool
value: "true"
initial_ast: 75fbb3ed1613fbf39ce803ff903befe209b26a953ba8db1d68e35066655d96e6
canonicalized_ast: a96cae2c9e347245e07c63b5c94cf43497063c3f548c615627da4b1775e9a17b
type_inferenced_ast: dc663974ed1cce7b15c35eda29c9b1af5426eafddbd108b5a03cd7071ad4a6bc

View File

@ -19,4 +19,4 @@ outputs:
initial_ast: 3aa0745060289c1a1af4e66265f8a92a89caff1731dc70d8c6a59798152f1a38
imports_resolved_ast: 3aa0745060289c1a1af4e66265f8a92a89caff1731dc70d8c6a59798152f1a38
canonicalized_ast: a1acfd3169b8f72975cd7cc9ef2059cd8fb1ed5ea0a7f51911d3365b52375e36
type_inferenced_ast: 55d57669ceeb95e039cb000e3673f7590c2bd69bb67786057977d158ab77dbdb
type_inferenced_ast: f84470f86eadd14d2a9a56e4f1c2ff349610064704c30b169f15f0bd82b61959

View File

@ -18,7 +18,7 @@ outputs:
inner:
Identifier: "{\"name\":\"y\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":1,\\\"col_stop\\\":2,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"y as id\\\"}\"}"
target_type:
CircuitOrAlias: "{\"name\":\"id\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"y as id\\\"}\"}"
Identifier: "{\"name\":\"id\",\"span\":\"{\\\"line_start\\\":1,\\\"line_stop\\\":1,\\\"col_start\\\":6,\\\"col_stop\\\":8,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"y as id\\\"}\"}"
span:
line_start: 1
line_stop: 1

View File

@ -19,7 +19,7 @@ outputs:
const_: false
mutable: true
type_:
CircuitOrAlias: "{\"name\":\"MyCircuit\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":15,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}"
Identifier: "{\"name\":\"MyCircuit\",\"span\":\"{\\\"line_start\\\":3,\\\"line_stop\\\":3,\\\"col_start\\\":15,\\\"col_stop\\\":24,\\\"path\\\":\\\"\\\",\\\"content\\\":\\\"function x(x: MyCircuit) {\\\"}\"}"
span:
line_start: 3
line_stop: 3