Change name to Reid

This commit is contained in:
Teascade 2017-08-28 09:51:06 +00:00
parent 28bd52fa09
commit 4198b43b1d

View File

@ -1,5 +1,5 @@
# Omega
# Reid
- [What?](#what)
- [Why?](#why)
@ -8,25 +8,28 @@
- [Specification](#table-of-contents)
## What?
Omega is a language intended for scripting purposes. Omega compiler `omegac` reads `.og` files which contain Omega-code (specified below), which will then be parsed into bytecode. The parsed bytecode then, unless otherwise stated (via a `--no-output` compile-flag), will produce `.ogc` files, which function as compiled Omega, which can then be run with the Omega-interpreter `omega`. If stated, the `omegac` compiler can contain the `omega` interpreter with it aswell, and in such case, can run the parsed bytecode right away with a `--run` -flag.
Reid is a language intended for scripting purposes. Reid compiler `reidc` reads `.reid` files which contain Reid-code (specified below), which will then be parsed into bytecode. The parsed bytecode then, unless otherwise stated (via a `--no-output` compile-flag), will produce `.reidc` files, which function as compiled Reid, which can then be run with the Reid-interpreter `reid`. If stated, the `reidc` compiler can contain the `reid` interpreter with it aswell, and in such case, can run the parsed bytecode right away with a `--run` -flag.
**But why "Reid"?**
Reid is a letter in the old nordic alphabet that means "ride" or "journey", so the meaning was quite fitting (this langauge is quite a "wild ride"), and the name was pretty cool, and the letter made a cool and easy to make logo.
## Why?
The original version of Omega was written in TypeScript for a NodeJS server for a dungeons and dragons system client. The new server is being written in Rust, so the language must be re-written. To make the process easier, here is the specifications (and technically the documentation) for the re-visited version of the language. To the same repository I will be creating the actual Rust implementation of this language too.
The original version of Reid was written in TypeScript for a NodeJS server for a dungeons and dragons system client. The new server is being written in Rust, so the language must be re-written. To make the process easier, here is the specifications (and technically the documentation) for the re-visited version of the language. To the same repository I will be creating the actual Rust implementation of this language too.
The original version of Omega can be viewed [here](https://github.com/excitedneon/hero.neon.moe/blob/master/ts/omegaParser.ts)
The original version of Reid (originally called Omega) can be viewed [here](https://github.com/excitedneon/hero.neon.moe/blob/master/ts/omegaParser.ts)
## Who?
Omega is created by [Teascade](https://teasca.de), original version being written with TypeScript in 2016, and new specification and Rust implementation written in 2017.
Reid is created by [Teascade](https://teasca.de), original version being written with TypeScript in 2016, and new specification and Rust implementation written in 2017.
## License?
Currently Omega has no license, since it is only a specification, but most likely it will be licensed under MIT later.
Currently Reid has no license, since it is only a specification, but most likely it will be licensed under MIT later.
The Omega specification is simply [CC-BY-SA](http://creativecommons.org/licenses/by-sa/4.0/):
The Reid specification is simply [CC-BY-SA](http://creativecommons.org/licenses/by-sa/4.0/):
<a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png" /></a>
## Table of Contents
Table of contents for the Omega spec
Table of contents for the Reid spec
- [Examples](#examples)
- [General syntax](#general-syntax)
- [Expressions](#expressions)
@ -55,10 +58,10 @@ for (let i = 0; i < max; i++) {
```
## General Syntax
The general syntax of Omega is fairly similar to that of [TypeScript](https://www.typescriptlang.org/) or [Rust](https://www.rust-lang.org/). The syntax is a mix of [keywords](#keywords) and [expressions](#expressions) displayed such as in the [examples](#examples).
The general syntax of Reid is fairly similar to that of [TypeScript](https://www.typescriptlang.org/) or [Rust](https://www.rust-lang.org/). The syntax is a mix of [keywords](#keywords) and [expressions](#expressions) displayed such as in the [examples](#examples).
## Expressions
Expressions are a set of [values](#values), [function calls](#function-calls) and [operators](#operators) that Omega interprets and returns a new [value](#values) out of.
Expressions are a set of [values](#values), [function calls](#function-calls) and [operators](#operators) that Reid interprets and returns a new [value](#values) out of.
For example `2 + 3` is an expression combined by a `+`-[operator](#operators) which will result `5`
@ -186,7 +189,7 @@ For example:
- `(unwrap optional) * 5`
## Values
There are a number of values you can assign to your variables, as of Omega 1.0, only primitive values are possible. Such types are:
There are a number of values you can assign to your variables, as of Reid 1.0, only primitive values are possible. Such types are:
- `string`, a basic piece of text, defined as followes: `"String here"`.
- `char`, contains a single character, defined as follows: `'c'`
- `i16` (or usually short), a basic 16-bit integer value, such as `3` or `11`.
@ -201,7 +204,7 @@ There are a number of values you can assign to your variables, as of Omega 1.0,
- For example: `i32[4]()` would create an `i32`-array with 4 slots.
- Slots in an array are accessible with the standard `array[i]` syntax.
Values in Omega are strongly typed, meaning combining two different types cannot be combined, unless they are successfully cast.
Values in Reid are strongly typed, meaning combining two different types cannot be combined, unless they are successfully cast.
Default values for these types are as follows:
- `0` for `i16`, `i32`, `i64`, `f32`, and `f64`.
@ -221,7 +224,7 @@ If you however use numbers with decimals like `5.0`, `32.2` or `73.1`, their typ
If it is necessary to specify the type of the number (ie. for [function overloading](#function-overloading)), you can simply add the type immediately after the number, e.g. `5i32`, `32f32`, or `12i16`.
## Special cases
There are some special (mostly arithmetic) cases where different languages might act one way or another, so here are a list of those cases and how Omega handles them:
There are some special (mostly arithmetic) cases where different languages might act one way or another, so here are a list of those cases and how Reid handles them:
**Division by zero (`x / 0`)**
This causes a runtime exception.
@ -233,7 +236,7 @@ This also causes a runtime exception, as can be deducted.
Trying to assign a number larger or smaller than the byte-limit of the type allows (ie. larger than `2147483647` for `i32` or smaller than `-2147483647`), will cause a runtime exception.
## Function Overloading
[Function overloading](https://en.wikipedia.org/wiki/Function_overloading) in Omega is possible, meaning you can create functions that have the same name as other already existing functions, but the parameter count and/or parameter types must differ.
[Function overloading](https://en.wikipedia.org/wiki/Function_overloading) in Reid is possible, meaning you can create functions that have the same name as other already existing functions, but the parameter count and/or parameter types must differ.
ie. you could have two functions called `test`, both of which require a parameter `param`, but the other function's `param` is a string type, and the other is `i32`, like so:
```
def test(param: string) {
@ -283,7 +286,7 @@ let test_var = print("hi!"); // Causes a compile-time error; print has no return
- After whitespace, there may be (or must be, if no type-definition is given), an equals`=`-sign, after which there must be more whitespace, after which the [value](#value) of the variable is given. This is simply an [assignment operator](#assignment-operators).
- After the value of the variable, the `let`-expression **must** end in a semicolon `;`.
- If you try to set the value of a variable via a function that has no [return](#return) type defined, a compile-time error occurs.
- There is no "null- or void-type" in Omega.
- There is no "null- or void-type" in Reid.
#### `if`
Defines an if-statement, which will, if the condition is met, enter the scope defined _after_ the if.
@ -502,7 +505,7 @@ if (int_opt?) {
- [`time_now64() -> i64`](#time_now64---i64)
#### `print(text: string)`
Prints `text` to standard (stdout, to console by default). This is configurable by changing stdout in the Omega VM.
Prints `text` to standard (stdout, to console by default). This is configurable by changing stdout in the Reid VM.
#### `floor(number: T) -> T`
Floors `number` (rounding downwards), where T is either `f32` or `f64`, and then returns the value of the floor of that same type.