diff --git a/grammar/Cargo.toml b/grammar/Cargo.toml index 95ce49f544..1325e5b017 100644 --- a/grammar/Cargo.toml +++ b/grammar/Cargo.toml @@ -22,8 +22,8 @@ name = "leo_grammar" path = "src/main.rs" [[bench]] -name = "ast" -path = "benches/ast.rs" +name = "grammar" +path = "benches/grammar.rs" harness = false [dependencies.from-pest] diff --git a/grammar/benches/ast.rs b/grammar/benches/grammar.rs similarity index 100% rename from grammar/benches/ast.rs rename to grammar/benches/grammar.rs diff --git a/grammar/benches/main.leo b/grammar/benches/main.leo index 6b094d9aae..a769e0fdff 100644 --- a/grammar/benches/main.leo +++ b/grammar/benches/main.leo @@ -2,7 +2,7 @@ circuit PedersenHash { parameters: [group; 256], // Instantiates a Pedersen hash circuit - static function new(parameters: [group; 256]) -> Self { + function new(self, parameters: [group; 256]) -> Self { return Self { parameters: parameters } } diff --git a/grammar/src/ast.rs b/grammar/src/ast.rs index 48a4a2802e..0da55a7a31 100644 --- a/grammar/src/ast.rs +++ b/grammar/src/ast.rs @@ -44,8 +44,8 @@ use pest::{ #[grammar = "leo.pest"] pub struct LanguageParser; -pub fn parse(input: &str) -> Result, Error> { - LanguageParser::parse(Rule::file, input) +pub fn parse(program_string: &str) -> Result, Error> { + LanguageParser::parse(Rule::file, program_string) } pub(crate) fn span_into_string(span: Span) -> String { diff --git a/grammar/src/lib.rs b/grammar/src/lib.rs index d38b826c08..af8451fb15 100644 --- a/grammar/src/lib.rs +++ b/grammar/src/lib.rs @@ -53,7 +53,8 @@ pub(crate) use span::*; use from_pest::FromPest; use std::{fs, path::Path}; -/// The pest abstract syntax tree (ast) for a Leo program. +/// +/// The grammar of a Leo program, encoded as an abstract syntax tree (AST). /// /// The [`Grammar`] type represents a Leo program as a series of recursive data types. /// These data types form a tree that begins from a [`File`] type root. diff --git a/wasm/.resources/main.leo b/wasm/.resources/main.leo new file mode 100644 index 0000000000..e69de29bb2 diff --git a/wasm/src/grammar.rs b/wasm/src/grammar.rs new file mode 100644 index 0000000000..e69de29bb2