-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
159 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
title: About The Language | ||
weight: 1 | ||
description: Nevalang is a general purpose flow-based programming language with static structural typing that compiles to machine code and Go and designed with visual programming in mind. | ||
--- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
title: FAQ | ||
weight: 6 | ||
description: Answer to questions about language design. | ||
--- | ||
|
||
## What is this? | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
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. | ||
|
||
```neva | ||
component Main(start any) (stop any) { | ||
net { in:start -> out:stop } | ||
} | ||
``` | ||
|
||
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. | ||
|
||
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." | ||
|
||
```neva | ||
Main (start any) (stop any) | ||
``` | ||
|
||
Next, we see a block of curly braces `{}` and inside another one with the keyword `net`. | ||
|
||
```neva | ||
{ | ||
net { in:start -> out:stop } | ||
} | ||
``` | ||
|
||
Ports are the _interface_ of a component, but in addition to the interface, a component also needs a _body_ - code that describes what exactly the component does, what work it performs. In this case, the curly braces are the body, and `net` is the _network_ - the computational scheme of the component. | ||
|
||
In Nevalang, programming is _flow-based_, and instead of controlling the flow of execution, as in conventional languages, we control the flow of data. We don't call functions, don't execute instructions; we just route messages from one place to another, thus creating a graph that describes how data flows through the program. That's why such programming is called flow-based. | ||
|
||
In this case, we see that data flows directly from the input port `start` to the output port `stop`. | ||
|
||
``` | ||
in:start -> out:stop | ||
``` | ||
|
||
In other words, our Main component does nothing. It just lets data pass through itself without having any impact on the external world. Essentially, it could be called a bypass, but in a Nevalang program, there must always be at least one `Main` component (we'll understand why later). | ||
|
||
The curious reader may wonder, what about `in:` and `out:`? Why couldn't we just write `start -> stop`? The fact is that there can be any number of ports for both input and output (although typically there are no more than three on each side). Input and output ports can sometimes have the same names. To avoid confusion, we specify the direction - `in` is input, and `out` is output. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
title: Hello World | ||
weight: 3 | ||
--- | ||
|
||
Isn't it odd to reach the "Hello, World!" moment only in the third lesson - the starting point that most tutorials begin with? Well, many peculiarities await us in Nevalang. However, we hope that by the end of this tutorial, they will no longer seem like oddities. Who knows, you might even start thinking, "Could it have been any other way?". Of course, we could have started with "Hello, World!" too, without delving into the intricate details of how every little thing works, but our goal, once again, is to achieve a deep understanding of how Nevalang is structured. And, actually, "Hello, World!" is not as straightforward as it seems. | ||
|
||
```neva | ||
const greeting string = 'Hello, World!' | ||
component Main(start any) (stop any) { | ||
nodes { | ||
#bind(greeting) | ||
greeting Emitter<string> | ||
printer Printer<string> | ||
blocker Blocker<string> | ||
} | ||
net { | ||
in:start -> blocker:sig | ||
greeting:msg -> blocker:data | ||
blocker:data -> printer:msg | ||
printer:msg -> out:stop | ||
} | ||
} | ||
``` | ||
|
||
You might be thinking right now - "This is the most verbose 'Hello, World!' I've ever seen!" And, quite likely, you are correct. But don't rush to close the page; by dissecting this example, we'll learn how to write code more concisely. Without going through this example and jumping straight to the shorter version, we would never understand how the short version actually works. | ||
|
||
TODO... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
title: Tutorial | ||
weight: 3 | ||
description: "Welcome to the 'Learn Nevalang the Hard Way' tutorial! This comprehensive guide is designed to teach you the Nevalang programming language through detailed examples, covering everything you need to grasp the full scope of the language. | ||
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!" | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
{{ define "main" }} | ||
<div class="row"> | ||
<aside class="col-3">{{ partial "docs-nav.html" . }}</aside> | ||
<div class="col-9"> | ||
<h1>{{ .Title }}</h1> | ||
{{ .Content }} | ||
<h1 class="text-center">{{.Title}}</h1> | ||
<div> | ||
{{ range .Pages }} | ||
<a href="{{ .RelPermalink }}" class="card docs-card"> | ||
<h2>{{ .Title }}</h2> | ||
<p>{{ .Description }}</p> | ||
</a> | ||
{{ end }} | ||
</div> | ||
</div> | ||
{{ end }} | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters