From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id yDJ3AWDsKmfJFwAA62LTzQ:P1 (envelope-from ) for ; Wed, 06 Nov 2024 05:11:12 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id yDJ3AWDsKmfJFwAA62LTzQ (envelope-from ) for ; Wed, 06 Nov 2024 05:11:12 +0100 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=oqOG+8by; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=p1Z8nE5j; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1"); dmarc=pass (policy=none) header.from=maniero.me ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1730866271; 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: in-reply-to:in-reply-to:references:references:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=5nsK5rWqveFXBkiyatg+TZcfJzzrM9epKaM1TCnZEdk=; b=Y0dHbs8a7KIpEI9sEubRaEJ9ui3uZSzB8WxJicb4gFoINPuoT2YhtZvquu5I9NbZrxYiTy kxInttbliPbTdb3LPoD67MlEECmlFzZZtepu8No7dM3W3EieQuOfrXWf+92xWeO6p8HPDB Bi65UKLopATGm40nL6IhSJtIK9WimQ0gyRZ9djZbdRtJDVUvBuOQUUMPmmrJUwDzdDSlJp wMMvnbuVtASa9AMiyaHGlPu7BZnrTA2a2c+sBh9QPpUIhTw/mY+BGIrM06G9pEPHlJJAPF /BGM8X8pAT8oxkq+ZY+aVJt36LzafhWxc1I8laYlh5NrGlMkOb1G62YURAO6NQ== ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1730866271; a=rsa-sha256; cv=pass; b=GTNH8N7aD7lhuFvz9IBGLK8qBPz9GBCvqhObHSwV4Ww50LiqVR9NDYDP2FbiBTgwt50nw0 FeFDB5kZPdgsh1vH8IAUZ94ba/MbkemVlUgjkoxyFt0QQsjMPfummVROhdLr/Qq0V2AIBc EwxoXoSWbjO4DGqWFqXhrp6ji7lgJ8jA73kXslba/icyN4lzd8kYYq1zrxC24SbDT1oIgW KuM9ZNJj/U7xFO/OkDMCw2Kb18GhMX3eIjyxHTfRDzthIvNFMJNVrgV3N0xXF+Q6YBkIEj ebADVvLf0wtrFT+V1SxKfgoQONpg7oG3P14eVFQG/ow43MbfLlIGCZbEvYWcyg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=oqOG+8by; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=p1Z8nE5j; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1"); dmarc=pass (policy=none) header.from=maniero.me 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 CD1C0509AA for ; Wed, 06 Nov 2024 05:11:11 +0100 (CET) DKIM-Signature: a=rsa-sha256; bh=nTRSKajyLVj1WtLdNmDWvBU/8oxOZ56yl3KrC4vW30I=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:In-Reply-To:References:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1730866268; v=1; b=oqOG+8by4mKEjw6rjTktQrLQThAWRtFC+FsZ2Gv06IZcZZP5nJdQ2i2JqaOjgSYOoLFN527Y QJ3kzFplLDWzdeyIRXOshZJ8gyQZUgV/SFKApnDzJu4YmtmSRi1fIu+ns0p1i+wAqnZK3m39VnC C//P6PXs6JNZQhfm+vCDeeqssn8ba7lHb/KwQhgQ+fbfmfiY2XD/s51JDBE5ruXlPj58Mp2sXUC bHdJMEHmNyCUs6oNXwZpAZkSvD9UQmJJs/+udCqOJKf24fwPTXE+why3qkand+JIIO9/R0S2p9m 5GWbT0ZfF1Epz892ri6KjhP5b6QGOUnL3IxEenp7bioIQ== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 5899C201F1 for ; Wed, 06 Nov 2024 04:11:08 +0000 (UTC) Received: from bisque.elm.relay.mailchannels.net (bisque.elm.relay.mailchannels.net [23.83.212.18]) by mail-a.sr.ht (Postfix) with ESMTPS id 5CD8E20228 for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 06 Nov 2024 04:11:07 +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 BA9688C41CE for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 6 Nov 2024 04:11:05 +0000 (UTC) Received: from fr-int-smtpout5.hostinger.io (trex-14.trex.outbound.svc.cluster.local [100.109.10.188]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 289228C2645 for <~johnnyrichard/olang-devel@lists.sr.ht>; Wed, 6 Nov 2024 04:11:05 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1730866265; a=rsa-sha256; cv=none; b=hG8x1XENGcG44NzCab+0uf69TBOkVVMG29LgHxhIFbnQzkqo+6E03iolBBWXfLFodLKEyq ChWuJbuCC3aHqFSqSDoN/pzkud86TjYzxznhdQ3FcnOxGerBwQ8mGUc03Fm8DHUevS0YWG d/3pVIqNnBG+nI3Kq8cXB770yWJLHPZXgY9CADMOoZLfVTEDvPqlGbaEMtTjH1e/KaHpgh K2GFh4YcNnBXSMDZi4f3BUbvjmAytqGF3uZwQNkpVYutqY8DS3Mp5T3pJz7ZdGfA5OFLs0 R7ETOcF8pmRAFGziug8fCAi3onu1Gmaja9/g1b8kWsY7ilZ/QQnWOqKx2FtWPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1730866265; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5nsK5rWqveFXBkiyatg+TZcfJzzrM9epKaM1TCnZEdk=; b=kmuGdWy5k3tzi+CfSvN62UWo4B64Ddw+1BxFQOFH8jMwSwA0siTbUWH4C1w/N/63+uV+7C zlHrIivTj8NQreQ689CG2s4pLri6tyjtkvRBDZ8M1GmNDsTvDm0G/2iGT0exkDCbxSxVwT nu2qUtSh9v2txt/bkM6S/iIz0YdgXDZi5EKyaXDNFLfw09hHALqGRCsot3SNzS91/4tEBJ iASkxzvZQj9V+ySMih1qCrwmtwR9ueXa0JphkQIqxgL5JxcsDGfteeSsmbMhrLUfLxDYpN 9DWa9jcnCo6oMw2EWCNc242W5o0/hmKuCl95PxFanzHIZRcq3eGLDCt8u6ZL0A== ARC-Authentication-Results: i=1; rspamd-78c64749d6-tm2vn; 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-Abortive-Oafish: 53c8427d211451f6_1730866265648_2956038147 X-MC-Loop-Signature: 1730866265648:4024332860 X-MC-Ingress-Time: 1730866265648 Received: from fr-int-smtpout5.hostinger.io (fr-int-smtpout5.hostinger.io [89.116.146.168]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.109.10.188 (trex/7.0.2); Wed, 06 Nov 2024 04:11:05 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1730866262; 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: in-reply-to:in-reply-to:references:references; bh=5nsK5rWqveFXBkiyatg+TZcfJzzrM9epKaM1TCnZEdk=; b=p1Z8nE5j6jIiJhSed72HlIeOM6XOKBjRn1FwOjkiMapv6T/RBRor/W2s76eTKkrgfyE3XD uYw484Asays8A1PLt61iY20WSzDSgowWVDXS+OIG+henD+p4w7BgKMenBmqZ2v3IvITbOJ C3y14ctEfgAhysijaKCNLtUMFJkNx+xVtCIsxojfCbT2r38v4RUGEn9mAnZoHaQJpHNjqX V7LT4VsCUDhUv9MaJpk11uR4a0WETPDMiaPTYOnGnYG+LL6/d2ALh2mkzKBrKWwgWiu356 aUYmxVCGv+Q7wd7CBdm61/bZQ5BRNgEc+o+aNADmv228RJFzXnG00XzwOaW1Qg== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v1 1/2] docs: add pointer docs Message-ID: <20241106041055.194975-2-carlos@maniero.me> X-Mailer: git-send-email 2.46.1 In-Reply-To: <20241106041055.194975-1-carlos@maniero.me> References: <20241106041055.194975-1-carlos@maniero.me> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Wed, 06 Nov 2024 04:11:02 +0000 (UTC) X-CM-Envelope: MS4xfHTa7TKdoUmikEOcipKDs+8phz9KRov36TbWj8PFAd4G2cgU/oovLBna//4aiATbwMEO+eZ5RRaeIe6Mt2o18zcxjfdtqn+B7zhVw/nREg6i86JrVhNS 3xc5SFOBGrsvLHlo9TjH6ei6P7gsgNUt9sq5sZP3iYbZAhGnUh8cFWCxnuB+yoLbw77p713tMf4yq9jr70jQETbJ/TB19ZG1wSp8gYLmRjfuXfhzby5ybx1G X-CM-Analysis: v=2.4 cv=Z6G+H2RA c=1 sm=1 tr=0 ts=672aec56 a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=9om99gvBadkziw_48KcA:9 a=BXDaF_L80NY05PYiAFlV:22 X-AuthUser: carlos@maniero.me X-Sourcehut-Patchset-Status: UNKNOWN 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: -4.74 X-Spam-Score: -4.74 X-Migadu-Queue-Id: CD1C0509AA X-Migadu-Scanner: mx13.migadu.com X-TUID: 55VEHIctcdpx Signed-off-by: Carlos Maniero --- docs/info/getting-started.texi | 37 ++++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/docs/info/getting-started.texi b/docs/info/getting-started.texi index 5547446..77b9298 100644 --- a/docs/info/getting-started.texi +++ b/docs/info/getting-started.texi @@ -6,11 +6,13 @@ basics of the language's syntax. We'll cover variables, data types, operators, control flow, and functions. By the end of this chapter, you'll have a solid foundation in the O language -syntax and be ready to start writing your own programs. Let's dive in! +syntax and be ready to start writing your own programs. If you are already +familiar with C-like languages, you will find out that @code{O} behave pretty +much the same with some small quirks. Let's dive in! @section An olang program -An O programmin language program starts with a @code{main} function. This +An O programming language program starts with a @code{main} function. This function must return the program exit code. @verbatim @@ -120,8 +122,6 @@ Unsigned 64 bits. @section Binary Operations -Binary operations are pretty much like C. - @subsection Logical @table @samp @@ -249,3 +249,32 @@ expr1 % expr2 @end verbatim @end table + +@section Pointers + +Dealing with memory address. + +@subsection Address of (&) + +Get the address of a variable. + +@verbatim +var my_var: u32 = 0 + +var my_pointer: u32* = &my_var +@end verbatim + +@subsection Dereferencing (*) + +Accessing the value of the address a pointer points to. + +@verbatim +var my_var: u32 = 0 + +# The result of *my_pointer is the value of my_var (0). +*my_pointer + +*my_pointer = 42 +@end verbatim + +The program above sets the @code{my_var}'s to 42. -- 2.46.1