From 4959f63c240f873da0192fcdc7daa0329d5afd9e Mon Sep 17 00:00:00 2001 From: Peter Matta <mattapet@fit.cvut.cz> Date: Tue, 24 Apr 2018 10:39:19 +0200 Subject: [PATCH] Added function return type --- grammar.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/grammar.txt b/grammar.txt index 6ffd388..272b93b 100644 --- a/grammar.txt +++ b/grammar.txt @@ -12,7 +12,11 @@ DeclVal -> '=' Expr // '=' // DeclArray -> Expr // '(', identifier, number_literal, '-' // DeclArray -> ']' '=' ArrayLiteral // ']' -Func -> 'func' identifier '(' Args ')' Block // 'func' +Func -> 'func' identifier '(' Args ')' RetType Block // 'func' +RetType -> epsilon // _ | '{' +RetType -> '->' RetType_ // '->' +RetType_ -> 'void' // 'void' +RetType_ -> 'Int' // 'Int' Block -> '{' Block_ '}' // '{' Block_ -> epsilon // _ | '}' -- GitLab