Skip to content

Commit

Permalink
[FIX] Some syntax error in mdbook
Browse files Browse the repository at this point in the history
  • Loading branch information
Tipbs committed Jan 14, 2024
1 parent 1e39da2 commit 921e167
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 23 deletions.
2 changes: 1 addition & 1 deletion docs/language-doc/book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ authors = ["MizuriGit"]
language = "en"
multilingual = false
src = "src"
title = "Documentation of our super language"
title = "Documentation of Kope language"
3 changes: 2 additions & 1 deletion docs/language-doc/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
- [Function that returns a value](./function_with_return.md)
- [Conditions](./conditions.md)
- [If Statements](./if_statements.md)
- [Lists](./lists.md)
- [While Statements](./while_statements.md)
<!-- - [Lists](./lists.md) -->
10 changes: 9 additions & 1 deletion docs/language-doc/src/conditions.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This language cover a various number of operators returning boolean values
- `a > b` greater thané
- `a >= `greater than or equal to b
- `a == b` equal to
- `a != b` not equal to
- `a /= b` not equal to

Their use is pretty straight forward, you can get the boolean value and store it as a variable or use it in **if statements**

Expand All @@ -16,4 +16,12 @@ var value = 1 == 2;
// value == false
```

Condition can be combined thanks to this operator:
- `a && b` and
- `a || b` or
```
var value = 1 == 2 || true == true;
// value == true
```

As we said earlier, they can be use in **if statements**, check out next page...
8 changes: 4 additions & 4 deletions docs/language-doc/src/function_with_return.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ As said on the [Hello world! page](./hello_world.md), functions can return value

#### **`main.kop`**
```
int sum(x, y)
fn sum(x, y)
{
return x + y;
}
int main(argc, argv)
fn main()
{
var x = 5;
var y = 8;
var z = sum(x, y);
print(z)
print(sum(z, x))
print(z);
print(sum(z, x));
}
```

Expand Down
6 changes: 1 addition & 5 deletions docs/language-doc/src/hello_world.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,13 @@ The `main` function is the function that is being executed first, so if we want

#### **`main.kop`**
```
fn main(argc, argv)
fn main()
{
print("Hello world!\n");
}
```
There you go, Hello world!

The `main` function takes 2 arguments:
- `argc`, being the number of arguments passed from the command line
- `argv`, being an array containing the arguments passed from the command line

The `print` function takes 1 argument, here a string, that is gonna be written to the screen. The `\n` at the end of the string means that we want to add a new-line at after the text.

Now that we have created our `main` function printing "Hello world!" to the terminal, we need to compile and run our code, head up to the next part to learn how!
11 changes: 3 additions & 8 deletions docs/language-doc/src/if_statements.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ Usage of if statements is pretty straight forward and easy to use.
```
if (condition) {
...
} else {
...
}
};
```

If you'd like to see a real example
Expand All @@ -17,11 +15,8 @@ If you'd like to see a real example
fn main(argc, argv)
{
if (4 > 9) {
print("It is true!")
} else {
print("It is false!")
}
}
print("It is true!");
};
```

To learn how to compile the file, [check this out!](./compile_and_run.md)
Expand Down
4 changes: 1 addition & 3 deletions docs/language-doc/src/introduction.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Introduction

Welcome to the documentation for GLaDOS, a custom language created in Haskell that allows users to write programs in the kope syntax.

GLaDOS simplifies the process of creating and running programs by seamlessly translating kope-syntax-coded programs into WebAssembly, an industry-standard binary instruction format. This allows for cross-platform compatibility and efficient execution of code.
Welcome to the documentation for Kope, our language inspired by C and javascript and compiled in WebAssembly by our GlaDOS Project.
30 changes: 30 additions & 0 deletions docs/language-doc/src/while_statements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# While Statements

Usage of while statements is pretty straight forward and easy to use.

```
while (condition) {
...
};
```

If you'd like to see a real example

#### **`main.kop`**
```
fn main(argc, argv)
{
var i = 0
print("Here are all digit: ")
While (i < 10) {
print(i);
print(" ");
};
```

To learn how to compile the file, [check this out!](./compile_and_run.md)

```sh
> ./GLaDOS -r executable
Here are all digit: 1 2 3 4 5 6 7 8 9
```

0 comments on commit 921e167

Please sign in to comment.