Fix the grammar benchmark

This commit is contained in:
howardwu 2021-02-04 09:30:38 -08:00
parent bd2bd1f40f
commit 55002db847
7 changed files with 7 additions and 6 deletions

View File

@ -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]

View File

@ -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 }
}

View File

@ -44,8 +44,8 @@ use pest::{
#[grammar = "leo.pest"]
pub struct LanguageParser;
pub fn parse(input: &str) -> Result<Pairs<Rule>, Error<Rule>> {
LanguageParser::parse(Rule::file, input)
pub fn parse(program_string: &str) -> Result<Pairs<Rule>, Error<Rule>> {
LanguageParser::parse(Rule::file, program_string)
}
pub(crate) fn span_into_string(span: Span) -> String {

View File

@ -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.

0
wasm/.resources/main.leo Normal file
View File

0
wasm/src/grammar.rs Normal file
View File