From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 4PZPEKl6BWbpjgAAqHPOHw:P1 (envelope-from ) for ; Thu, 28 Mar 2024 15:11:53 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id 4PZPEKl6BWbpjgAAqHPOHw (envelope-from ) for ; Thu, 28 Mar 2024 15:11:53 +0100 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; none 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 3644914975 for ; Thu, 28 Mar 2024 15:11:53 +0100 (CET) DKIM-Signature: a=rsa-sha256; bh=0gOFC6Sy7cqW9ZCtio95PcAuN+M1wROajVcWbMBfgxs=; c=simple/simple; d=lists.sr.ht; h=Date:Cc:Subject:From:To:References:In-Reply-To:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1711635113; v=1; b=L5uFKX2B0LA5j12hQKzsqkJinhZhwfHFCXkYc3lSkk0hxoBVktesjoNayFWjBWJTEnOpJof5 ScTfqku22IlRLHnCo4IzWhVuIySCur2Pr3L0biy4u0fqP9Lt5JXhIWBZEiy1a4ddmAAI9rx9fT3 w2MJA6yh0Dq7bvTHtygpXtIObWg7JBBgU9AqV5kCcR2JQ1Q4fQJQvv7eXZTnj0Tz9QX5dOtvrHs yKtegEMmhJjzA7qeo7w6RIClwiDpG+St7pYfUcBUqJK0SF2B04S9uBO367waVZTrUeegXqZLrbg H37edaGPYSjNluX0IY91OIbF/xCuCNhMqRdDzJNph9LIw== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id E7474202EE for ; Thu, 28 Mar 2024 14:11:52 +0000 (UTC) Received: from rusty.tulip.relay.mailchannels.net (rusty.tulip.relay.mailchannels.net [23.83.218.252]) by mail-a.sr.ht (Postfix) with ESMTPS id E76FC20295 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 28 Mar 2024 14:11:51 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 0CF1B82A64 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 28 Mar 2024 14:11:50 +0000 (UTC) Received: from nl-srv-smtpout3.hostinger.io (unknown [127.0.0.6]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 32BAC81E33 for <~johnnyrichard/olang-devel@lists.sr.ht>; Thu, 28 Mar 2024 14:11:48 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1711635108; a=rsa-sha256; cv=none; b=hssoyYSE2ygK0Haw5xDyyvxlnqVQWDa9u8PiMbTq9GFPYeCt1R5tR4GjI9/uNuzDKuIJsn 0nYhoWg4qXxthXFc8ZgglmakYAOac31ajYagxVnga0+l/0WLNc2KvT5zqPAATMBfZ0Wwye Zvr/Ul4YRqIfl2OkhdZtm3MNoRG3HSe02wpIQczCoOQjQRiJI+PRslyzlVawFWGiGm55Gc +iy5RPqUtFll59eh+EkL5GSX5Z3Ba47AfCupKis3OXFovPjcFdkJPi7Ej7QKInyhW+p6D+ fUJaS+NLVaN4vBLG/dJs5+13ZrfiHD2Uf4ZaKedpWNVYgSfHXL58+aUyNKTR7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1711635108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RV3rFBDOYxTBpY0d9gKK2Mbf40atawWpbMMZlySxrAc=; b=cjJSATJXiPpBgIB997/fPGtQ3ZoNx9YqyDsetoIJznHh+HwaUE6emCQ4xUH+BUxG8puO8K Ei1aIGIMXtX77zzUXK2I6GaOlm6T/A+38MYiGn0zlI7wYfICXHqCWxsoLmrp2b/WHqkTxj UIjAGD/BqHFtAurcns0dUL6/hQ5HKz+coqbO5I8Hxb2mZRLCg9yUzluDL6pqgnzdlyz68O Xld/7JiGXhv0O28URC9tu6m4AP8hI6aHIPLGjLHdCIt1Wv/0dsnsN+t5Shy5HjVA36OqpT pIA+2W6Xv4OWsnhhO3W8HexpWzWJZkGQCIE7urW4a+rD/JwDyrYuPVOd56X0Zg== ARC-Authentication-Results: i=1; rspamd-7f6944c677-2tbdz; auth=pass smtp.auth=hostingeremail smtp.mailfrom=carlos@maniero.me X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|carlos@maniero.me X-MailChannels-Auth-Id: hostingeremail X-Occur-Absorbed: 26ed1b6820792666_1711635108949_1951503629 X-MC-Loop-Signature: 1711635108949:266829832 X-MC-Ingress-Time: 1711635108948 Received: from nl-srv-smtpout3.hostinger.io (nl-srv-smtpout3.hostinger.io [145.14.159.43]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.99.130.136 (trex/6.9.2); Thu, 28 Mar 2024 14:11:48 +0000 Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1711635103; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RV3rFBDOYxTBpY0d9gKK2Mbf40atawWpbMMZlySxrAc=; b=uKdY6yl/xCwTzUHvhyKVPC6hKT+ABwujVMFt363E6rFl1+ij4cBnLUNyPneW9BBSOAvmnm KlvmJOlVTyarttdaStpri8zJ22H804DxIKZ4EBa4rlvN66PzmThPDfi8OeFjbBxvkB7FTn TTRM6CRHWAATEeMUsr1AJPH5mjgNb72cAxJGzQoW71C2/5CyNSeCYLf1VIUoPmEjM0/WOG GubadZ5ucNXxMxtP2nh7dok2VMKde85xGPC5aIfnSKw3KF5FMhIw2g6mCeklsS6Zzxt+hD sGCtf7Xl3uoNfZ89DtKjSb10pCszlv85PMsBf+baHAsf91wO8i0yJmDHSW7ZQw== Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 28 Mar 2024 11:11:38 -0300 Message-Id: Cc: <~johnnyrichard/olang-devel@lists.sr.ht> Subject: Re: [PATCH olang v1 2/2] docs: spec: add variables and constants specification From: "Carlos Maniero" To: "Johnny Richard" X-Mailer: aerc 0.15.2-211-g37d5fc691aff References: <20240327032128.406911-1-carlos@maniero.me> <20240327032128.406911-3-carlos@maniero.me> In-Reply-To: X-CM-Envelope: MS4xfILDzAvlVJ/feyZUo6hk/mI1SX7mb6VDr8Tnyvso9HbXp3xKXHUtTvqjTqKKKNqrcbz7huM6vnz1Q1wZRpmNbtrDnI8FszM79BF0BW9KlDbRXWaYXHnn kl/1KfHoIqe36Vnrey2283+E1tBGjMrkNSvMoQaF/mbLkYurImAgB3yhReS6lofmDxR6onJrDTjanUXqGFUewhUcFO5lmHT25bmWt4eg2NLB3JBe05oHORX2 mHWXPIu89Pl8ipJ2ox9guA== X-CM-Analysis: v=2.4 cv=YaC75RRf c=1 sm=1 tr=0 ts=66057a9f a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=IkcTkHD0fZMA:10 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=JuBGnqVAZTsOzupAwMMA:9 a=QEXdDO2ut3YA:10 a=BXDaF_L80NY05PYiAFlV:22 X-AuthUser: carlos@maniero.me 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-Spam-Score: -4.00 X-Migadu-Queue-Id: 3644914975 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -4.00 X-TUID: Gnfrn0nvJt1f On Wed Mar 27, 2024 at 6:37 PM -03, Johnny Richard wrote: > On Wed, Mar 27, 2024 at 12:21:28AM -0300, Carlos Maniero wrote: > > This commit introduces the specification for variables and constants. A > > valid program under this specification is as follows: > >=20 > > var x: u32 =3D 1 > > Since this patch adds support to assignments, lets also add support to > all assignment operators like "-=3D" "+=3D" "<<=3D" and so on. > > > const y: u32 =3D 2 > > This patch lacks support to the following valid assignment expression > (which I think adds flexibility to the language): > > var x: u32 =3D a =3D b =3D c =3D 1 > var y: u32 > y =3D a =3D b =3D c =3D 1 > > > - ::=3D > > + ::=3D | | | > > nitpick: maybe _external-declaration_ sounds better since definitions are > not statements? What do you think about *file-declarations* a file declaration? Does not mean that it is external. At least while we try to define a file. > > > + > > +(* Variables *) > > + ::=3D 'var' ':' = ? > > + ::=3D 'const' ':' > > We don't need to define twice the variable-definition for "var" and > "const", let's combine both in a single rule. I don't know if you noticed, but variables has an optional assignment while const has required assignment. > > > + ::=3D > > + ::=3D '=3D' > > + ::=3D > > =20 > > (* Functions *) > > ::=3D 'fn' > > @@ -38,11 +46,11 @@ language. > > ::=3D '{' ( > > )* ? '}' > > ::=3D ';' | | > > - ::=3D > > + ::=3D | = | | > > ::=3D 'return' > > =20 > > (* Expressions *) > > - ::=3D > > + ::=3D | > > =20 > > (* Identifiers *) > > ::=3D 'u32' > > --=20 > > 2.34.1 > >=20 > > I have done few adjustments according to my feedback (I also fix the > unnecessary line breaks on function and block). Let me know what you > think about it. > > ---->8---- > Subject: [PATCH olang] fixup! docs: spec: add variables and constants spe= cification > > > diff --git a/docs/pages/language-specification.md b/docs/pages/language-s= pecification.md > index 708b679..2650dd9 100644 > --- a/docs/pages/language-specification.md > +++ b/docs/pages/language-specification.md > @@ -22,35 +22,45 @@ language. > =20 > ``` > (* Entry Point *) > - ::=3D ( )* > + ::=3D ( ( | ))* Way more elegant! Thanks. > =20 > - ::=3D | | | > + ::=3D =20 > + | > + | > =20 > (* Variables *) > - ::=3D 'var' ':' <= type> ? > - ::=3D 'const' ':' = > - > - ::=3D > - ::=3D '=3D' > - ::=3D > + ::=3D <= ows> ':' ( )? This is invalid for const unless we want to allow unassigned constants. It also can be interpreted as a semantic error, in that case I believe the spec should not check for semantics. > + ::=3D 'var' > + | 'const' > + ::=3D > =20 > (* Functions *) > - ::=3D 'fn' > - ':' > + ::=3D 'fn' ':' > ::=3D > ::=3D '(' ')' > ::=3D > ::=3D > =20 > (* Statements *) > - ::=3D '{' ( > - )* ? '}' > - ::=3D ';' | | > - ::=3D | |= | > + ::=3D '{' ( )* ? '}' > + ::=3D ';' | > + ::=3D | |= > ::=3D 'return' > =20 > (* Expressions *) > - ::=3D | > + ::=3D | | > + ::=3D > + ::=3D '=3D' > + | '*=3D' > + | '/=3D' > + | '%=3D' > + | '+=3D' > + | '-=3D' > + | '<<=3D' > + | '>>=3D' > + | '&=3D' > + | '^=3D' > + | '|=3D' > =20 > (* Identifiers *) > ::=3D 'u32'