Skip to content

Commit

Permalink
Merge pull request #2 from lachsdachs/main
Browse files Browse the repository at this point in the history
Fixing some typos in the tutorial
  • Loading branch information
emil14 authored Mar 9, 2024
2 parents 2be3ecf + b7d2d6a commit b8eb43e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions content/docs/tutorial/01/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: A Program That Does Nothing
weight: 1
---

Here is the smallest program in Nevalang that compiles. It absolutely does nothing, but by looking at it, you can learn a lot about Nevalang.
Here is the smallest program in Nevalang that compiles. It does absolutely nothing, but by looking at it, you can learn a lot about Nevalang.

```neva
component Main(start any) (stop any) {
Expand All @@ -13,9 +13,9 @@ component Main(start any) (stop any) {

Let's break down what's written here.

A Nevalang program consists of _components_ that send _messages_ to each other through _ports_ but ports cannot be connected randomly. Each port has its own _data type_, and when we connect one port to another, the compiler checks if they are _compatible_. Otherwise, it throws an error.
A Nevalang program consists of _components_ that send _messages_ to each other through _ports_, but ports cannot be connected randomly. Each port has its own _data type_, and when we connect one port to another, the compiler checks if they are _compatible_. Otherwise, it throws an error.

It states that there is a "Main" component (every component has a name), with two ports - one for input - `start` - and one for output - `stop`. The data type of both ports is `any` - a universal data type, saying "I am compatible with any types of data."
It states that there is a "Main" component (every component has a name), with two ports - one for input - `start` - and one for output - `stop`. The data type of both ports is `any` - a universal data type, saying "I am compatible with any type of data."

```neva
Main (start any) (stop any)
Expand Down Expand Up @@ -43,4 +43,4 @@ In other words, our Main component does nothing. It just lets data pass through

## What's Next?

What, think this program isn't useful enough? Then let's move on to the [next chapter](/docs/tutorial/02)!
What, you think this program isn't useful enough? Then let's move on to the [next chapter](/docs/tutorial/02)!
12 changes: 6 additions & 6 deletions content/docs/tutorial/02/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If you've gone through the quick start, you should have already created your fir
neva new test
```

With these command, we're creating a _module_. We'll learn more about modules later, but for now, remember that any Nevalang program consists of at least one module.
With this command, we're creating a _module_. We'll learn more about modules later, but for now, remember that any Nevalang program consists of at least one module.

Each module has a `neva.yml` file, which describes its _dependencies_ (modules can depend on other modules, in this case, there are no dependencies) and the required version of the compiler (in this case, 0.0.1). Such a file is called the module's _manifest_.

Expand All @@ -33,13 +33,13 @@ component Main(start any) (stop any) {
}
```

Now make sure that you're in the `test` directory and run `neva run src`. Terminal should block until you type something. Type anything e.g. "how are you?". If everything is okay you should see this output:
Now make sure that you're in the `test` directory and run `neva run src`. The terminal should block until you type something. Type anything, e.g. "how are you?". If everything is okay you should see this output:

```bash
> how are you?
```

The program printer what you've entered and quit. That's all it does.
As you can see, the program prints what you've entered and quits. That's all it does.

## Packages, Std Module, Builtin Package

Expand Down Expand Up @@ -89,15 +89,15 @@ pub Printer<T>(data T) (sig T)

We will not yet touch upon what `#extern` and `pub` mean, as we still have to understand these. Let's focus on the interface. We see that the `Printer` component has an input port `data` with type `T` and an output port `sig` also with type `T`. But what is this type `T`?

It's all about this code `Printer<T>`. Such a syntactic construction, where triangle brackets follow the component's name, and within them are letters (typically uppercase), is called type parameters. In this case, the `Printer` component has one parameter `T`. Essentially, this means that when instantiating this component, that is, when creating a node based on it, we need to provide a type argument.
It's all about this code `Printer<T>`. Such a syntactic construction, where triangle brackets follow the component's name, and within them are letters (typically uppercase), is called a type parameter. In this case, the `Printer` component has one parameter `T`. Essentially, this means that when instantiating this component (when creating a node based on it) we need to provide a type argument.

In our case, we provide `string` and
In our case, we provide a `string` and

```
Printer<T>(data T) (sig T)
```

Transforms for us into
Behaves as

```
Printer(data string) (sig string)
Expand Down
4 changes: 2 additions & 2 deletions content/docs/tutorial/05/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ title: To be continued...
weight: 5
---

Unfortunately documentation isn't finished. We haven't cover a lot of stuff including interfaces and dependency injection, array ports and streams, error handling, working with structures and enums and a lot more.
Unfortunately documentation isn't finished. We haven't covered a lot of stuff including interfaces and dependency injection, array ports and streams, error handling, working with structures and enums and a lot more.

Please refer to [examples](https://github.com/nevalang/neva/tree/main/examples) in the Nevalang's git repository. Meanwile we will continue to improve documentation.
Please refer to the [examples](https://github.com/nevalang/neva/tree/main/examples) in the Nevalang's git repository. Meanwile we will continue to improve documentation.

As always, PRs are welcome. Also feel free to ask questions in the [community](/community).
2 changes: 1 addition & 1 deletion content/docs/tutorial/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ Welcome to the 'Learn Nevalang the Hard Way' tutorial! This comprehensive guide

In this tutorial, you'll explore and simplify many small programs, moving from complex and wordy to simple and clear. By breaking these down step by step, you'll fully understand how things work in Nevalang, ensuring that nothing feels like magic. Let's dive in!

Start from [program that does nothing](/docs/tutorial/01).
Start from a [program that does nothing](/docs/tutorial/01).

0 comments on commit b8eb43e

Please sign in to comment.