public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
From: Johnny Richard <johnny@johnnyrichard.com>
To: ~johnnyrichard/olang-devel@lists.sr.ht
Cc: Johnny Richard <johnny@johnnyrichard.com>
Subject: [PATCH olang v1 1/3] spec: add function params and function call
Date: Tue, 24 Sep 2024 00:19:58 +0200	[thread overview]
Message-ID: <20240923222229.151017-2-johnny@johnnyrichard.com> (raw)
In-Reply-To: <20240923222229.151017-1-johnny@johnnyrichard.com>

Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
---
 docs/info/specification.texi | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/docs/info/specification.texi b/docs/info/specification.texi
index df5c029..9144133 100644
--- a/docs/info/specification.texi
+++ b/docs/info/specification.texi
@@ -33,13 +33,15 @@ language.
 <variable-initializer>  ::= '=' <ows> <expression>
 
 (* Functions *)
-<function-definition> ::= 'fn' <ws> <function-name> <ows> <function-parameters> <ows> ':' <ows> <return-type> <ows> <function-body>
+<function-definition> ::= 'fn' <ws> <function-name> <ows> '(' ( <ows> | <ows> <function-params> <ows> ) ')' <ows> ':' <ows> <return-type> <ows> <function-body>
 <function-name>       ::= <identifier>
-<function-parameters> ::= '(' <ows> ')'
+<function-params>     ::= <identifier> <ows> ':' <ows> <type> ( <ows> ',' <function-params>)*
 <return-type>         ::= <type>
 <function-body>       ::= <block>
 <block>               ::= '{' <ows> <statement> <ows> (<end-of-statement> <ows> <statement> <ows>)* <end-of-statement>? <ows> '}'
-<statement>           ::= <common-statement> | <if-statement> | <return-statement>
+<function-args>       ::= <expression> (<ows> ',' <function-args>)*
+<function-call>       ::= <function-name> <ows> '(' ( <ows> | <ows> <function-args> <ows> ) ')'
+<statement>           ::= <common-statement> | <if-statement> | <return-statement> | <function-call>
 <if-statement>        ::= 'if' <ws> <expression> <ows> <block>
 <return-statement>    ::= 'return' <ws> <expression>
 
@@ -74,6 +76,7 @@ language.
 <multiplicative-expression> ::= <primary-expression> (<ows> ('*' | '/' | '%') <ows> <primary-expression>)*
 <primary-expression> ::= <integer-literal>
                        | <variable-name>
+                       | <function-call>
                        | '(' <ows>  <expression> <ows> ')'
 
 (* Identifiers *)
-- 
2.46.0


  reply	other threads:[~2024-09-23 22:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 22:19 [PATCH olang v1 0/3] parse function definition params Johnny Richard
2024-09-23 22:19 ` Johnny Richard [this message]
2024-09-23 22:19 ` [PATCH olang v1 2/3] lexer: add token comma Johnny Richard
2024-09-23 22:23   ` [olang/patches/.build.yml] build success builds.sr.ht
2024-09-23 22:20 ` [PATCH olang v1 3/3] parser: parse function params Johnny Richard
2024-09-24  8:03 ` [PATCH olang v1 0/3] parse function definition params Carlos Maniero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240923222229.151017-2-johnny@johnnyrichard.com \
    --to=johnny@johnnyrichard.com \
    --cc=~johnnyrichard/olang-devel@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.johnnyrichard.com/olang.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox