-
Notifications
You must be signed in to change notification settings - Fork 9
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
7 changed files
with
81 additions
and
8 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# Enums |
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,12 @@ | ||
# Types | ||
|
||
Vine is statically typed. Every expression has a type, like `Bool` or | ||
`List[N32]`. Type parameters are written in square brackets. | ||
|
||
Types fall in to several categories: | ||
|
||
- [primitive types](./primitives.md) are fundamental types defined by the | ||
compiler | ||
- [standard types](./primitives.md) are commonly-used types defined by the | ||
standard library | ||
- [structs](./structs.md) and [enums](./enums.md) are user-defined types |
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,56 @@ | ||
# Primitive Types | ||
|
||
## `N32` | ||
|
||
The type `N32` describes natural numbers[^nats], represented with 32 bits of | ||
precision. | ||
|
||
`N32` values can be written as literals in decimal (`46`), hex (`0x2e`), or | ||
binary (`0b101110`). Digits can be separated with underscores (`1_000_000`). | ||
|
||
`N32`s support the usual arithmetic and bitwise operators (`4 * 11 + 2`, | ||
`5 << 3 | 6`) | ||
|
||
## `F32` | ||
|
||
The type `F32` describes 32-bit floating-point numbers (following IEEE 754). | ||
|
||
`F32` values can be written as literals (`4.6e1`). The decimal point is | ||
required. | ||
|
||
`F32`s support the usual arithmetic operators (`3.6 * 12.3 + 1.72`). | ||
|
||
## `Char` | ||
|
||
The type `Char` describes Unicode code points. `Char`s are primarily used within | ||
`List`s to form `String`s. | ||
|
||
`Char` values can be written as literals using single quotes (`'.'`). | ||
|
||
`Char`s support adding an `N32`, resulting in another `Char` (`'a' + 4`), as | ||
well as subtracting another `Char`, resulting in an `N32` (`'G' - 'A'`). | ||
|
||
## `Bool` | ||
|
||
The type `Bool` describes booleans. | ||
|
||
The two `Bool` values can be written as literals (`true`, `false`). | ||
|
||
`Bool`s support the usual short-circuiting logical operators (`&&`, `||`, `!`) | ||
and non-short-circuiting ("bitwise") operators (`&`, `|`, `^`). | ||
|
||
Expressions that evaluate to booleans are called [conditions](./conditions.md). | ||
|
||
## `IO` | ||
|
||
`IO` is a special primitive type used to interact with the outside world. Values | ||
of this type cannot be explicitly constructed; instead, an `IO` handle is passed | ||
in to `main` at the start of the program. See the section on [IO](../io.md) for | ||
more detail. | ||
|
||
--- | ||
|
||
[^nats]: Natural numbers are non-negative integers. In other programming | ||
languages, they are often referred to as "unsigned integers". Seeing as | ||
positive integers do have a sign (namely, a positive sign), the only truly | ||
unsigned integer is zero. |
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 @@ | ||
# Standard |
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 @@ | ||
# Structs |
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 +1,5 @@ | ||
# Getting Started | ||
|
||
## [Installation](./installation.md) | ||
|
||
## [Hello, world!](./hello-world.md) |