* [olang/patches/.build.yml] build success
2024-04-16 23:35 [PATCH olang v2] docs: spec: add binary expressions Johnny Richard
@ 2024-04-16 22:40 ` builds.sr.ht
2024-04-16 22:45 ` [PATCH olang v2] docs: spec: add binary expressions Carlos Maniero
2024-04-16 23:47 ` Johnny Richard
2 siblings, 0 replies; 4+ messages in thread
From: builds.sr.ht @ 2024-04-16 22:40 UTC (permalink / raw)
To: Johnny Richard; +Cc: ~johnnyrichard/olang-devel
olang/patches/.build.yml: SUCCESS in 44s
[docs: spec: add binary expressions][0] v2 from [Johnny Richard][1]
[0]: https://lists.sr.ht/~johnnyrichard/olang-devel/patches/51076
[1]: mailto:johnny@johnnyrichard.com
✓ #1197709 SUCCESS olang/patches/.build.yml https://builds.sr.ht/~johnnyrichard/job/1197709
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH olang v2] docs: spec: add binary expressions
2024-04-16 23:35 [PATCH olang v2] docs: spec: add binary expressions Johnny Richard
2024-04-16 22:40 ` [olang/patches/.build.yml] build success builds.sr.ht
@ 2024-04-16 22:45 ` Carlos Maniero
2024-04-16 23:47 ` Johnny Richard
2 siblings, 0 replies; 4+ messages in thread
From: Carlos Maniero @ 2024-04-16 22:45 UTC (permalink / raw)
To: Johnny Richard, ~johnnyrichard/olang-devel; +Cc: Ricardo Kagawa
Reviewed-by: carlos@maniero.me
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH olang v2] docs: spec: add binary expressions
@ 2024-04-16 23:35 Johnny Richard
2024-04-16 22:40 ` [olang/patches/.build.yml] build success builds.sr.ht
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Johnny Richard @ 2024-04-16 23:35 UTC (permalink / raw)
To: ~johnnyrichard/olang-devel; +Cc: Johnny Richard, Ricardo Kagawa
The parser already implements binary operations, but currently we are
missing it on the language specification.
This change adds the already implemented binary operations grammar and
also enables expression with parenthesis.
It's important to mention that the precedence was highly inspired on C.
Signed-off-by: Johnny Richard <johnny@johnnyrichard.com>
---
v1 -> v2: rebase on current main branch.
docs/pages/language-specification.md | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/docs/pages/language-specification.md b/docs/pages/language-specification.md
index 3cf050e..a9931c1 100644
--- a/docs/pages/language-specification.md
+++ b/docs/pages/language-specification.md
@@ -50,7 +50,21 @@ language.
<assignment-operator> ::= '='
(* Expressions *)
-<expression> ::= <integer-literal> | <variable-name>
+<expression> ::= <binary-expression>
+<binary-expression> ::= <logical-or-expression>
+<logical-or-expression> ::= <logical-and-expression> (<ows> '||' <ows> <logical-and-expression>)*
+<logical-and-expression> ::= <bitwise-or-expression> (<ows> '&&' <ows> <bitwise-or-expression>)*
+<bitwise-or-expression> ::= <bitwise-xor-expression> (<ows> '|' <ows> <bitwise-xor-expression>)*
+<bitwise-xor-expression> ::= <bitwise-and-expression> (<ows> '^' <ows> <bitwise-and-expression>)*
+<bitwise-and-expression> ::= <cmp-eq-and-neq-expression> (<ows> '&' <ows> <cmp-eq-and-neq-expression>)*
+<cmp-eq-and-neq-expression> ::= <cmp-lt-and-gt-expression> (<ows> ('==' | '!=') <ows> <cmp-lt-and-gt-expression>)*
+<cmp-lt-and-gt-expression> ::= <bitwise-shift-expression> (<ows> ('<' | '>') <ows> <bitwise-shift-expression>)*
+<bitwise-shift-expression> ::= <additive-expression> (<ows> ('<<' | '>>') <ows> <additive-expression>)*
+<additive-expression> ::= <multiplicative-expression> (<ows> ('+' | '-') <ows> <multiplicative-expression>)*
+<multiplicative-expression> ::= <primary-expression> (<ows> ('*' | '/') <ows> <primary-expression>)*
+<primary-expression> ::= <integer-literal>
+ | <variable-name>
+ | '(' <ows> <expression> <ows> ')'
(* Identifiers *)
<type> ::= 'u32'
base-commit: 00469200f51f96921d31310af587a1f5b808d87a --
2.44.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH olang v2] docs: spec: add binary expressions
2024-04-16 23:35 [PATCH olang v2] docs: spec: add binary expressions Johnny Richard
2024-04-16 22:40 ` [olang/patches/.build.yml] build success builds.sr.ht
2024-04-16 22:45 ` [PATCH olang v2] docs: spec: add binary expressions Carlos Maniero
@ 2024-04-16 23:47 ` Johnny Richard
2 siblings, 0 replies; 4+ messages in thread
From: Johnny Richard @ 2024-04-16 23:47 UTC (permalink / raw)
To: ~johnnyrichard/olang-devel; +Cc: Ricardo Kagawa
Patch applied! Thanks for reviewing it!
build: https://builds.sr.ht/~johnnyrichard/job/1197715
To git.sr.ht:~johnnyrichard/olang
0046920..59a09b8 main -> main
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-16 22:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-16 23:35 [PATCH olang v2] docs: spec: add binary expressions Johnny Richard
2024-04-16 22:40 ` [olang/patches/.build.yml] build success builds.sr.ht
2024-04-16 22:45 ` [PATCH olang v2] docs: spec: add binary expressions Carlos Maniero
2024-04-16 23:47 ` Johnny Richard
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