diff --git a/CHANGELOG.md b/CHANGELOG.md index 98d25ae..b0ae4b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,11 @@ - Document code +## v0.0.7 + +- Parse minimal function declarations following a grammar + + ## v0.0.6 - Parse function declarations diff --git a/src/syntax/ast/functions.rs b/src/syntax/ast/functions.rs new file mode 100644 index 0000000..0cda11b --- /dev/null +++ b/src/syntax/ast/functions.rs @@ -0,0 +1,6 @@ + + +#[derive(Debug)] +pub struct FunctionCall { + identifier: Box +} diff --git a/src/syntax/ast.rs b/src/syntax/ast/mod.rs similarity index 97% rename from src/syntax/ast.rs rename to src/syntax/ast/mod.rs index e262536..5d10324 100644 --- a/src/syntax/ast.rs +++ b/src/syntax/ast/mod.rs @@ -1,3 +1,6 @@ +pub mod functions; + + pub struct ModuleAST { pub declarations: Vec, } diff --git a/src/syntax/functions/function_call.rs b/src/syntax/functions/function_call.rs new file mode 100644 index 0000000..1ea864d --- /dev/null +++ b/src/syntax/functions/function_call.rs @@ -0,0 +1,21 @@ +use crate::{lexic::token::Token, syntax::{ParseResult, ast::functions::FunctionCall}}; + + + +pub fn try_parse<'a>(tokens: &'a Vec, pos: usize) -> ParseResult { + + + + todo!() +} + + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn should_parse_1() { + + } +} diff --git a/src/syntax/functions/mod.rs b/src/syntax/functions/mod.rs new file mode 100644 index 0000000..7799ff1 --- /dev/null +++ b/src/syntax/functions/mod.rs @@ -0,0 +1 @@ +pub mod function_call; \ No newline at end of file diff --git a/src/syntax/grammar.md b/src/syntax/grammar.md index 03ffb3b..07ca086 100644 --- a/src/syntax/grammar.md +++ b/src/syntax/grammar.md @@ -42,4 +42,17 @@ block = "{", "}" ``` +## Function call + +```ebnf +function call = identifier, arguments list +``` + + +### Arguments list + +```ebnf +arguments list = "(", ")" +``` + diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 47759c6..7676466 100755 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -6,6 +6,7 @@ mod expression; mod function_declaration; mod params_list; mod utils; +mod functions; pub mod ast;