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 3/4] docs: spec: remove assignment as expression
Date: Tue, 16 Apr 2024 17:17:12 -0300	[thread overview]
Message-ID: <20240416201713.24723-4-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 the use of assignments as expressions, to prevent
chained assignments and the use of assignments inside potential future
 `if`, `while` and other statements. However, assignments are still
valid statements.

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

diff --git a/docs/pages/language-specification.md b/docs/pages/language-specification.md
index 8d8544a..724ed67 100644
--- a/docs/pages/language-specification.md
+++ b/docs/pages/language-specification.md
@@ -45,11 +45,8 @@ language.
 
 (* Statements *)
 <end-of-statement>    ::= ';' | <line-break>
-<common-statement>    ::= <variable-definition> | <assignment-expression>
-
-(* Expressions *)
-<expression>            ::= <integer-literal> | <variable-name>
-<assignment-expression> ::= <variable-name> <ows> <assignment-operator> <ows> <expression>
+<common-statement>    ::= <variable-definition> | <constant-definition> | <assignment>
+<assignment>          ::= <variable-name> <ows> <assignment-operator> <ows> <expression>
 <assignment-operator> ::= '='
                         | '*='
                         | '/='
@@ -62,6 +59,9 @@ language.
                         | '^='
                         | '|='
 
+(* Expressions *)
+<expression>          ::= <integer-literal> | <variable-name>
+
 (* Identifiers *)
 <type>                ::= 'u32'
 <identifier>          ::= (<alpha> | '_') (<alpha> | <digit> | '_')*
-- 
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 ` [PATCH 2/4] docs: spec: immediate constant initialization ricardo_kagawa
2024-04-16 22:33   ` Johnny Richard
2024-04-16 20:17 ` ricardo_kagawa [this message]
2024-04-16 22:34   ` [PATCH 3/4] docs: spec: remove assignment as expression 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-4-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