From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 8IkyEh/+HmZ7qQAA62LTzQ:P1 (envelope-from ) for ; Wed, 17 Apr 2024 00:39:27 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 8IkyEh/+HmZ7qQAA62LTzQ (envelope-from ) for ; Wed, 17 Apr 2024 00:39:27 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=NzpAeXMh; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b=lgJYdmY+; dmarc=pass (policy=quarantine) header.from=johnnyrichard.com; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1713307167; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=zHrJ3BPCitfet8i/NZFF7EnPDetfeATK5ZBD5KjN/zo=; b=apMADZ/gXgRjS7qREEcSSDywm3m0o11ho9FKwJdIDelIMWX0GTxK7gyBJiYSMlga2HCW/7 toVnTBwj1QcNGaQhzSS8NCqM2w7bji+xVyZ8tfIQAThJDZMQDDPnBcDECIgc698CchVpNv EPhq7pgKXskHlIC9CgBfDiMhXK2143zZ6egxE6Pju7uHB8QVMFw2l3uF4bnn1LXGo+tLA4 OH9Mggl7uymE6na5+cyXjIrf7FXTBsbysCgN5DdW7BLhjpDbPUeIM0gCV1qG+Y2uNMkmtp uXNUKT0BP1LEFzTUTVDod6dULR471hDNtDVsMPwgYZJRI0g8T2rMUpcg+n33TA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=NzpAeXMh; dkim=pass header.d=johnnyrichard.com header.s=key1 header.b=lgJYdmY+; dmarc=pass (policy=quarantine) header.from=johnnyrichard.com; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht ARC-Seal: i=1; s=key1; d=johnnyrichard.com; t=1713307167; a=rsa-sha256; cv=none; b=TtTyZYoed4Ut1LwugtuQ6bDevsLoD/PKFl7kZtajT45DgTMXFpTorZX++oNk+OFNCKpyl1 vCY/CuqY8+n76iPazKzkvWPppJ/lr2EfHjBxA2ZT/gRlY2A2RHILanAQbS8x8CE4w79svT 943UYvFzdZh+Rodv9LcwPaLelU7sf6XDwH0O8qzOZFeV1C/wK7CP1A9kUpuKDcJ+d1lEuV o/xjO87AABVx/JWsMzNPf43FyvZhj7abH0GXz/9rpNL0Xpcbr/fHrS6u2712EhGCQedgFZ jEvyJ3gQPnD1X04dmvIKnWuBxptkuWJofi3yv/OCa/uI08ZIj3yJy5x7pioP+w== Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 795943CF5E for ; Wed, 17 Apr 2024 00:39:26 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=er62u2nS8MJSh+pTo53+r41ExS7bngQ91zfQYb9LrAE=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1713307165; v=1; b=NzpAeXMhu/11abT5nZk6Tb4FWQl8p9Zu2u/0nHjFEpm3wy/TCgc8FXeiaiBm59AFGIPgbdcU dnxT0uYmofUugx9raIT3e3khxrvCBBqG/kYnAZPJAOAWaR4l9MVeB0SVV1r/0u7K51ymuHSUdAN AcyXZhvuy6HinMRt7ryWKRZQB/OxSrRVIuJfoQICmuF2GbPQMV6mGVHd+UGJzN506aEOFZEEolh SKZaF6PHRVG92t/2xQo56tVqVlAkiKRktv66Fq72YN6ZJnqU//JT071rCpyiMlos3vBJIC0bngn IERBUbHWnJ2lUYMg+3p3XniNJUqvVjb/C6kqhEiERA3vA== Received: from lists.sr.ht (unknown [IPv6:2a03:6000:1813:1337::154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 988652017B for ; Tue, 16 Apr 2024 22:39:25 +0000 (UTC) Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [IPv6:2001:41d0:203:375::ae]) by mail-a.sr.ht (Postfix) with ESMTPS id D7EF220165 for <~johnnyrichard/olang-devel@lists.sr.ht>; Tue, 16 Apr 2024 22:39:24 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1713307164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=zHrJ3BPCitfet8i/NZFF7EnPDetfeATK5ZBD5KjN/zo=; b=lgJYdmY+gzpanyPOv0y8lE66piMEvW2ximFrpY0CTud7GRzdn9Tpk72m43rqN2hvXChCjy k2FLPlDpC5ZbPxD8eMXIFQSP+0WHd0CaGopXoi4Ql/t/NooLiX7XW7fP0/WntK4/9PrpRE pahChYRFQLjjd42RBf2PTOSYpdjO7BHiSdrxoy0CvJ88mmOp+TdqZen9dzout1l2jwowaH vcJ0WKlJV38sNlVg3y1lFQOM4B+Kb3JolyC/BcfO8CYLZyDmQe3cL1kJJmXT2Rep+zO9Ge c+eTxMdASXzruEhmmrFEOo7GStt2va3eZNEZ3rmYzyOHS/UTRM507IJEXgof6g== From: Johnny Richard To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Johnny Richard , Ricardo Kagawa Subject: [PATCH olang v2] docs: spec: add binary expressions Date: Wed, 17 Apr 2024 01:35:39 +0200 Message-ID: <20240416233722.9441-1-johnny@johnnyrichard.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Sourcehut-Patchset-Status: PROPOSED List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Flow: FLOW_IN X-Migadu-Country: NL X-Migadu-Spam-Score: -9.06 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -9.06 X-Migadu-Queue-Id: 795943CF5E X-TUID: tKzL1wedLcsv 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 --- 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. ::= '=' (* Expressions *) - ::= | + ::= + ::= + ::= ( '||' )* + ::= ( '&&' )* + ::= ( '|' )* + ::= ( '^' )* + ::= ( '&' )* + ::= ( ('==' | '!=') )* + ::= ( ('<' | '>') )* + ::= ( ('<<' | '>>') )* + ::= ( ('+' | '-') )* + ::= ( ('*' | '/') )* + ::= + | + | '(' ')' (* Identifiers *) ::= 'u32' base-commit: 00469200f51f96921d31310af587a1f5b808d87a -- 2.44.0