public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
* [PATCH olang] docs: introduce olang for newcomers
@ 2024-10-08  3:15 Carlos Maniero
  2024-10-08  3:15 ` [olang/patches/.build.yml] build success builds.sr.ht
  2024-10-08  9:57 ` [PATCH olang] docs: introduce olang for newcomers Johnny Richard
  0 siblings, 2 replies; 3+ messages in thread
From: Carlos Maniero @ 2024-10-08  3:15 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Carlos Maniero

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 <carlos@maniero.me>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [olang/patches/.build.yml] build success
  2024-10-08  3:15 [PATCH olang] docs: introduce olang for newcomers Carlos Maniero
@ 2024-10-08  3:15 ` builds.sr.ht
  2024-10-08  9:57 ` [PATCH olang] docs: introduce olang for newcomers Johnny Richard
  1 sibling, 0 replies; 3+ messages in thread
From: builds.sr.ht @ 2024-10-08  3:15 UTC (permalink / raw)
  To: Carlos Maniero; +Cc: ~johnnyrichard/olang-devel

olang/patches/.build.yml: SUCCESS in 21s

[docs: introduce olang for newcomers][0] from [Carlos Maniero][1]

[0]: https://lists.sr.ht/~johnnyrichard/olang-devel/patches/55375
[1]: mailto:carlos@maniero.me

✓ #1346182 SUCCESS olang/patches/.build.yml https://builds.sr.ht/~johnnyrichard/job/1346182

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH olang] docs: introduce olang for newcomers
  2024-10-08  3:15 [PATCH olang] docs: introduce olang for newcomers Carlos Maniero
  2024-10-08  3:15 ` [olang/patches/.build.yml] build success builds.sr.ht
@ 2024-10-08  9:57 ` Johnny Richard
  1 sibling, 0 replies; 3+ messages in thread
From: Johnny Richard @ 2024-10-08  9:57 UTC (permalink / raw)
  To: Carlos Maniero; +Cc: ~johnnyrichard/olang-devel

LGTM, applied!

To git.sr.ht:~johnnyrichard/olang
   5415f1e..66e9ecf  main -> main


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-08  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-08  3:15 [PATCH olang] docs: introduce olang for newcomers Carlos Maniero
2024-10-08  3:15 ` [olang/patches/.build.yml] build success builds.sr.ht
2024-10-08  9:57 ` [PATCH olang] docs: introduce olang for newcomers 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