public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
From: ricardo_kagawa@disroot.org
To: ~johnnyrichard/olang-devel@lists.sr.ht
Cc: Ricardo Kagawa <ricardo_kagawa@disroot.org>
Subject: [PATCH 2/4] docs: spec: immediate constant initialization
Date: Tue, 16 Apr 2024 17:17:11 -0300	[thread overview]
Message-ID: <20240416201713.24723-3-ricardo_kagawa@disroot.org> (raw)
In-Reply-To: <20240416201713.24723-1-ricardo_kagawa@disroot.org>

From: Ricardo Kagawa <ricardo_kagawa@disroot.org>

This commit prevents declarations of uninitialized constants, as well as
prevents the use of assignment operators in variable and constant
declarations. This change was originally suggested by Maniero, with
different non-terminal names.

Signed-off-by: Ricardo Kagawa <ricardo_kagawa@disroot.org>
---
 docs/pages/language-specification.md | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/pages/language-specification.md b/docs/pages/language-specification.md
index 9f4383d..8d8544a 100644
--- a/docs/pages/language-specification.md
+++ b/docs/pages/language-specification.md
@@ -28,10 +28,10 @@ language.
 <external-declaration> ::= <common-statement> | <function-definition>
 
 (* Variables *)
-<variable-definition>  ::= <variable-qualifier> <ws> <variable-name> <ows> ':' <ows> <type> (<ows> <assignment-operator> <ows> <expression>)?
-<variable-qualifier>   ::= 'var'
-                         | 'const'
-<variable-name>        ::= <identifier>
+<variable-definition>   ::= 'var' <ws> <variable-name> <ows> ':' <ows> <type> <ows> <variable-initializer>?
+<constant-definition>   ::= 'const' <ws> <variable-name> <ows> ':' <ows> <type> <ows> <variable-initializer>
+<variable-name>         ::= <identifier>
+<variable-initializer>  ::= '=' <ows> <expression>
 
 (* Functions *)
 <function-definition> ::= 'fn' <ws> <function-name> <ows> <function-parameters> <ows> ':' <ows> <return-type> <ows> <function-body>
-- 
2.44.0


  parent reply	other threads:[~2024-04-16 20:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 20:17 [PATCH 0/4] docs: spec: constant initialization and assignments ricardo_kagawa
2024-04-16 20:17 ` [PATCH 1/4] docs: spec: refactor grammar specification ricardo_kagawa
2024-04-16 22:32   ` Johnny Richard
2024-04-16 20:17 ` ricardo_kagawa [this message]
2024-04-16 22:33   ` [PATCH 2/4] docs: spec: immediate constant initialization Johnny Richard
2024-04-16 20:17 ` [PATCH 3/4] docs: spec: remove assignment as expression ricardo_kagawa
2024-04-16 22:34   ` Johnny Richard
2024-04-16 20:17 ` [PATCH 4/4] docs: spec: postpone assignment operators ricardo_kagawa
2024-04-16 22:35   ` Johnny Richard
2024-04-16 21:58 ` [PATCH 0/4] docs: spec: constant initialization and assignments 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=20240416201713.24723-3-ricardo_kagawa@disroot.org \
    --to=ricardo_kagawa@disroot.org \
    --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