From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id ILjiCNKjBGcQRAEAqHPOHw:P1 (envelope-from ) for ; Tue, 08 Oct 2024 05:15:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id ILjiCNKjBGcQRAEAqHPOHw (envelope-from ) for ; Tue, 08 Oct 2024 05:15:30 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=SWW8m4kH; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=BuxW4PaW; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1"); 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=2; s=key1; d=johnnyrichard.com; t=1728357330; a=rsa-sha256; cv=pass; b=PZqhSHXuFPXpWdxaMmz4EdzCuA6FPsYBaLtawHHptGhe8CtME68M8COuHNKZst8mWm3i5i MiJJ94g+pSMg1QNKGqSIkZ6DRy7LE2yi4JW+Qlc3xfvZoG+qmm8tAn6nJhux1YIaWNISwd UI7sklpX1sckOAJlcHviAZPE0V+yQ82wj5Zp63w0QlapvqVHIoMlS6G29D6B3n4JYm9Hf0 bf8cIyjLhJpgLf/hC9TLxEljgy2nfAG9l/gH22poKH+cj0Vs5Eif00nfqtX3jYDrfFT+hR uo3XlAmKNh63XeKl/Vt5Wv55REtUJQCA68k0lazO+bZN0k9Pvgyplqj/veR2+g== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=SWW8m4kH; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=BuxW4PaW; dmarc=pass (policy=none) header.from=maniero.me; arc=pass ("mailchannels.net:s=arc-2022:i=1"); 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=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1728357330; 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=i33lcce8k7/VPi0VeP3L2J0W9uO4k4zMh50WOZNBZ0k=; b=CQs7prd8AHnAs19jvFuiHUmMC8Q0gkeS1afI44tOrSqq/s3oMj0giOR8nIPzDhtl2trCN4 UENWxB99MErh8FuZQRv25gp9LeVAOuLKo1oEq94qJPCw3KPoziK+kuSfrVfUR7H92Z0zMe ZyYlk+tjhHr+2XnV6+VPk+RjWFJYdNE6yDGxrjnkCA1Tl7LOpymNbhv8aMp0g7CWbsvj3o o6GsRL8Oakg+oUIyaqVzYSS+iLvUPh9kLB68FUg7DZ+bnRRE9TYU7pbmz3kdpv82FFqr3u QoHKDR71RJmRBN3GLCq6wbUdmjMJ8UcnwybeeNPddDz0VIaK97nCxrxQytCpKg== 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 DE9051F85D for ; Tue, 08 Oct 2024 05:15:29 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=69KSyiXxgrQN7vnCg/1Ld/ZySbPKqM6v9SVomsIGYCk=; 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=1728357324; v=1; b=SWW8m4kHWOxnS5K8kQFf+ZK092pLiplfi11RVgb/OalN1ebWo4B988aiOl6BwlGbmM0VzqUJ gReoN1dCal+qxc5u4N3nk9qj47yyV7KEZNktRz+EGQljaCzuEb5hvMZGmLuetI7RqCT0kdu6xsL 4FQHIYJZXtKeci/lUYIZEtLUvfRjeQd/Hd3p4zsa7PyfMfqRvEKz1bM8kKP+PsmETuoLvfZHrHg Rj+X1WS37mHXyaSjuCnG0i/IE3OLgqXH4MBowuxhJr94ehrolerrddi439lKlo4UV0fwGr/MyQa KkaDkPrDR4mdRRjj8SYVMTpxlBoaOCVw/6QNiWnH6hanw== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id A3CE1201DD for ; Tue, 08 Oct 2024 03:15:24 +0000 (UTC) Received: from seashell.cherry.relay.mailchannels.net (seashell.cherry.relay.mailchannels.net [23.83.223.162]) by mail-a.sr.ht (Postfix) with ESMTPS id 619BE201CC for <~johnnyrichard/olang-devel@lists.sr.ht>; Tue, 08 Oct 2024 03:15:20 +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 A1EF6902A97 for <~johnnyrichard/olang-devel@lists.sr.ht>; Tue, 8 Oct 2024 03:15:18 +0000 (UTC) Received: from fr-int-smtpout5.hostinger.io (100-96-86-86.trex-nlb.outbound.svc.cluster.local [100.96.86.86]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id D2036902B2F for <~johnnyrichard/olang-devel@lists.sr.ht>; Tue, 8 Oct 2024 03:15:17 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1728357318; a=rsa-sha256; cv=none; b=T7NkTiei7NNvmDcSlOHsfLN+YWdgMISLitRcN247Et2E9S0pvQuYHs+IdtgSoysrVrZ2sH UXe5Sk8LvFjBqV9Xphhr5QrQjjjWyFcLGiPayamEtjJKIR4mSVqQ/mPs/McaVXXNs14MYa 9bXuF4tzHlZjx3c+aK5MUZ+6pvjcwrkyWcHEIh5q7zcf5zUkogQcfRR+q1APdC90C7EQSM X8sJjWnHK+0/bwKkN3jmrS6nB4jv2Fcm4awCtvoBc6eoM9b5MeWQp35b9z3glvvr8xdWk6 p66gLuLG2Iiy8M4P7m+IfCnIex3zPGbDQes/hqFdLzbRKCz+I4dO3LAl2y3CwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1728357318; 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:dkim-signature; bh=i33lcce8k7/VPi0VeP3L2J0W9uO4k4zMh50WOZNBZ0k=; b=tug+3dY0//G7JURuyRyHo+6JMIeYQkSerjyhHvhLdg4oNymOkXyoXoPFmjAVuJyH1j79jV DzAMZ0mR5ba7ml7I4V5hHmMOYG3+r0Jjzc3LuDdPGTwxxXI1Oq75KCqMqwMHpoQ2+9Jw24 bHDYtkuFExH7v6CrP47RTt+hWhBSzhmdvzRzQelSXPKTc4BPjDpMv3Fwb7zTHDKxuKrXoz tHfXJox6U/uJFDSsKU7b05eY3n35UnrG9UbsM9WoXqHe4o7W/+YsRiwNPGvWF+7bcYm3iu zoAhYyNeLVLY6k5uPCVzdVnh+/ABr4ulUbw3y3X+BAl8zjV3xGI/8qHuVBX+bw== ARC-Authentication-Results: i=1; rspamd-b4cd7f459-v66dw; 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-Plucky-Tangy: 3ad508b6496db4b4_1728357318415_3296486570 X-MC-Loop-Signature: 1728357318415:1244966658 X-MC-Ingress-Time: 1728357318415 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.96.86.86 (trex/7.0.2); Tue, 08 Oct 2024 03:15:18 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1728357316; 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=i33lcce8k7/VPi0VeP3L2J0W9uO4k4zMh50WOZNBZ0k=; b=BuxW4PaWUSFgwkLpEt+bLGJrS1FBABEtWWJJ8dlqVRuQPI73kvMgvvqvZti2NfG+Q2COto BdyAL1mOmJTDEfeVZSF2gLkyyCIz/Su0pYDfKs7CMDZcD1dzuvfa6uk+jUFFSaL5P9w9RJ tZcLWINcWkg7eu2heEjyFLROOXUxpsvGyj+GAaV/5aEfBCnjfU7YpJgKnCUAQE3O2vl9oV LRQ+qCpvhfv4J/aG8wG8zHqb2AB2tOsX9FPhTkLWnFS7DxyeDTIKqMLzsSPbAqXaa4hrzo DuPaL9ozuRapQ3wZi6gMx184nNmMVedEnhKX9vah1d5D64vmVIjLlCe9k/Tviw== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang] docs: introduce olang for newcomers Message-ID: <20241008031511.20808-1-carlos@maniero.me> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Tue, 08 Oct 2024 03:15:15 +0000 (UTC) X-CM-Envelope: MS4xfI1wcVsPMhwN8VQzswxHE13uEGrlK7XQWA12toITAfVYZX9jPf/ubdI3rIjXnC8RZVmzuySy1XqjfZH6pzrbWeyvskxEC34UWnKVqtbCej/BL21BxHNZ cIVyhBpHeHsmOoSFayiioULjy35j2Qdrt1Wns14PO5m1pXuJhBhGeCXXQ3QBxT1Ox/QW+BmJYo8cv/n5thvGKEDvuQy0YRw7K2N+k4oCPgnjCGMkS6RoM0a5 X-CM-Analysis: v=2.4 cv=Z6G+H2RA c=1 sm=1 tr=0 ts=6704a3c3 a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=84FfdSJSW5ofsn1DjYcA:9 a=BXDaF_L80NY05PYiAFlV:22 X-AuthUser: carlos@maniero.me 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-Country: NL X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -5.72 X-Spam-Score: -5.72 X-Migadu-Queue-Id: DE9051F85D X-Migadu-Scanner: mx10.migadu.com X-TUID: k+6m9w5lFMX3 The section introduction and getting started was empty in our manual. Even that this is not the final documentation, this is something we can iterate over to provide a basic O programming language overview for newcomers. Signed-off-by: Carlos Maniero --- docs/info/getting-started.texi | 229 +++++++++++++++++++++++++++++++++ docs/info/introduction.texi | 6 + 2 files changed, 235 insertions(+) diff --git a/docs/info/getting-started.texi b/docs/info/getting-started.texi index e94f124..e9ff5d3 100644 --- a/docs/info/getting-started.texi +++ b/docs/info/getting-started.texi @@ -1,2 +1,231 @@ @node Getting Started @chapter Getting Started + +Welcome to the O programming language! This chapter will introduce you to the +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! + +@section An olang program + +An O programmin language program starts with a @code{main} function. This +function must return the program exit code. + +@verbatim +fn main(): u8 { + return 0; +} +@end verbatim + +To compile the program you can use @code{olc}. + +@verbatim +$ olc my_prog.ol -o my_prog +$ ./my_prog +@end verbatim + +@section Functions + +Unlike C, O language does not require function prototypes. This means you can +call a function before it's defined, making your code more flexible and easier +to read in many cases. + +@verbatim +fn main(): u8 { + return fib(8) +} + +fn add(a: u32, b: u32): u32 { + return a + b +} + +fn fib(n: u32): u32 { + if n <= 2 { + return n + } + + return add(fib(n - 1), fib(n - 2)) +} +@end verbatim + +@section Comments + +Comments starts with a @code{#}. + +@verbatim +# Hi I'm a comment and I'll be ignored by the compiler. +@end verbatim + +@section Variables + +@verbatim +var answer: u32 = 42 +@end verbatim + +@section Flow control + +Any non zero expr is true. + +@verbatim +if expr { + # statement +} else { + # statement +} +@end verbatim + +@section Primitive data types + +@table @samp + +@item u8 + +Unsigned 8 bits. + +@item u16 + +Unsigned 16 bits. + +@item u32 + +Unsigned 32 bits. + +@item u64 + +Unsigned 64 bits. + +@end table + +@section Binary Operations + +Binary operations are pretty much like C. + +@subsection Logical + +@table @samp + +@item Equals + +@verbatim +expr1 == expr2 +@end verbatim + +Results zero (false) or one (true). + +@item Less + +@verbatim +expr1 < expr2 +@end verbatim + +Results zero (false) or one (true). + +@item Less Equal + +@verbatim +expr1 <= expr2 +@end verbatim + +Results zero (false) or one (true). + +@item Greater + +@verbatim +expr1 > expr2 +@end verbatim + +Results zero (false) or one (true). + +@item Greater Equal + +@verbatim +expr1 >= expr2 +@end verbatim + +Results zero (false) or one (true). + +@item Or + +@verbatim +expr1 || expr2 +@end verbatim + +Results zero (false) if both are true or one (true) if any is true. + +@item And + +@verbatim +expr1 && expr2 +@end verbatim + +Results zero (false) if any is false or one (true) if both are true. + +@end table + +@subsection Bitwise + +@table @samp + +@item Shift left + +@verbatim +n << bits +@end verbatim + +@item Shift left + +@verbatim +n >> bits +@end verbatim + +@item And + +@verbatim +n & bits +@end verbatim + +@item Or + +@verbatim +n | bits +@end verbatim + +@end table + +@subsection Arithmetic + +@table @samp + +@item Addition + +@verbatim +expr1 + expr2 +@end verbatim + +@item Subtraction + +@verbatim +expr1 - expr2 +@end verbatim + +@item Multiplication + +@verbatim +expr1 * expr2 +@end verbatim + +@item Division + +@verbatim +expr1 / expr2 +@end verbatim + +@item Remaining + +@verbatim +expr1 % expr2 +@end verbatim + +@end table diff --git a/docs/info/introduction.texi b/docs/info/introduction.texi index 4fb7cbc..579880f 100644 --- a/docs/info/introduction.texi +++ b/docs/info/introduction.texi @@ -1,3 +1,9 @@ @node Introduction @chapter Introduction +Welcome to the O programming manual. This manual will guide you to learn the +language principles and how to contribute if you are a low level geek. + +Olang is a project maintained by enthusiast individuals across the globe. Join +us in the system programming language universe. Let's fight complexity +together. base-commit: 5415f1e48b199feb6d63461f0adfffafb13d005a -- 2.46.0